diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index c534a94e..c0f069c8 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -104,6 +104,25 @@ #define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0 #endif +// BOOST_UNORDERED_CXX11_CONSTRUCTION +// +// Use C++11 construction, requires variadic arguments, good construct support +// in allocator_traits and piecewise construction of std::pair +// Otherwise allocators aren't used for construction/destruction + +#if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT && \ + !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 0 && !defined(BOOST_NO_SFINAE_EXPR) +#define BOOST_UNORDERED_CXX11_CONSTRUCTION 1 +#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 +#define BOOST_UNORDERED_CXX11_CONSTRUCTION 1 +#endif +#endif + +#if !defined(BOOST_UNORDERED_CXX11_CONSTRUCTION) +#define BOOST_UNORDERED_CXX11_CONSTRUCTION 0 +#endif + // // Other configuration macros // @@ -765,13 +784,6 @@ template struct identity #include #include -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ - !defined(BOOST_NO_SFINAE_EXPR) -#define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 1 -#else -#define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 0 -#endif - namespace boost { namespace unordered { namespace detail { @@ -1040,7 +1052,7 @@ template struct allocator_traits } public: -#if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT +#if BOOST_UNORDERED_CXX11_CONSTRUCTION template static typename boost::enable_if_c< @@ -1195,8 +1207,6 @@ template struct allocator_traits #include -#define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 1 - namespace boost { namespace unordered { namespace detail { @@ -1222,8 +1232,6 @@ template struct rebind_wrap #include -#define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 0 - namespace boost { namespace unordered { namespace detail { @@ -1260,9 +1268,7 @@ namespace func { //////////////////////////////////////////////////////////////////////////// // call_construct -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - -#if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT +#if BOOST_UNORDERED_CXX11_CONSTRUCTION template inline void call_construct( @@ -1278,7 +1284,7 @@ inline void call_destroy(Alloc& alloc, T* x) boost::unordered::detail::allocator_traits::destroy(alloc, x); } -#else +#elif !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template inline void call_construct(Alloc&, T* address, BOOST_FWD_REF(Args)... args) @@ -1291,9 +1297,8 @@ template inline void call_destroy(Alloc&, T* x) boost::unordered::detail::func::destroy(x); } -#endif - #else + template inline void call_construct(Alloc&, T* address) {