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.
This commit is contained in:
Daniel James
2017-04-21 20:26:32 +01:00
parent a119caaa1b
commit 1e491533fa
2 changed files with 14 additions and 7 deletions

View File

@ -47,9 +47,6 @@
#include <stdexcept>
#include <utility>
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
#include <tuple>
#endif
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
#include <type_traits>
@ -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 <tuple>
#endif
#if defined(BOOST_UNORDERED_SUPPRESS_DEPRECATED)
#define BOOST_UNORDERED_DEPRECATED(msg)
#endif
@ -1391,8 +1399,7 @@ template <int N> 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 <class ValueType> 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
};

View File

@ -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,