From 1e491533fa11c81c5ae11b6e3f749b6b961bd7f3 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 21 Apr 2017 20:26:32 +0100 Subject: [PATCH] More consistent std::tuple configuration Was getting a weird test failure for Visual C++ 11, BOOST_NO_CXX11_HDR_TUPLE is defined, so the code doesn't support std::tuple, but BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT was also true, and so there are functions for constructing using std::piecewise_construct/std::tuple, which don't work. So, I'm assuming that if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT is true, then there must be a std::tuple. I guess it doesn't have full C++11 support, which is why BOOST_NO_CXX11_HDR_TUPLE is defined, but it appears to be good enough for us. If not, this will break things. --- .../boost/unordered/detail/implementation.hpp | 19 +++++++++++++------ test/unordered/unnecessary_copy_tests.cpp | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index c08adf29..480aef32 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -47,9 +47,6 @@ #include #include -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) -#include -#endif #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) #include @@ -127,6 +124,17 @@ // Other configuration macros // +#if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT || \ + (!defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(__SUNPRO_CC)) +#define BOOST_UNORDERED_HAS_STD_TUPLE 1 +#else +#define BOOST_UNORDERED_HAS_STD_TUPLE 0 +#endif + +#if BOOST_UNORDERED_HAS_STD_TUPLE +#include +#endif + #if defined(BOOST_UNORDERED_SUPPRESS_DEPRECATED) #define BOOST_UNORDERED_DEPRECATED(msg) #endif @@ -1391,8 +1399,7 @@ template struct length BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) -#if !BOOST_UNORDERED_CXX11_CONSTRUCTION && !defined(__SUNPRO_CC) && \ - !defined(BOOST_NO_CXX11_HDR_TUPLE) +#if !BOOST_UNORDERED_CXX11_CONSTRUCTION && BOOST_UNORDERED_HAS_STD_TUPLE BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::) #endif @@ -3541,7 +3548,7 @@ template struct map_extractor BOOST_UNORDERED_KEY_FROM_TUPLE(boost::) -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +#if BOOST_UNORDERED_HAS_STD_TUPLE BOOST_UNORDERED_KEY_FROM_TUPLE(std::) #endif }; diff --git a/test/unordered/unnecessary_copy_tests.cpp b/test/unordered/unnecessary_copy_tests.cpp index 7d17dfcf..7aea3111 100644 --- a/test/unordered/unnecessary_copy_tests.cpp +++ b/test/unordered/unnecessary_copy_tests.cpp @@ -501,7 +501,7 @@ UNORDERED_AUTO_TEST(unnecessary_copy_emplace_map_test) COPY_COUNT(0); MOVE_COUNT(0); -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) || defined(BOOST_HAS_TR1_TUPLE) +#if BOOST_UNORDERED_HAS_STD_TUPLE reset(); x.emplace(boost::unordered::piecewise_construct,