diff --git a/include/boost/unordered/detail/allocator_helpers.hpp b/include/boost/unordered/detail/allocator_helpers.hpp index bdc8d8e6..b0b6f175 100644 --- a/include/boost/unordered/detail/allocator_helpers.hpp +++ b/include/boost/unordered/detail/allocator_helpers.hpp @@ -31,14 +31,20 @@ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) # define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 1 # endif +# +# if defined(BOOST_MSVC) && BOOST_MSVC < 1400 +# define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 2 +# endif #endif #if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS) # define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0 #endif -#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 # include +#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 2 +# include #endif #if !defined(BOOST_NO_0X_HDR_TYPE_TRAITS) @@ -201,7 +207,7 @@ namespace boost { namespace unordered { namespace detail { // Uses the standard versions if available. // (although untested as I don't have access to a standard version yet) -#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 template struct allocator_traits : std::allocator_traits {}; @@ -213,6 +219,18 @@ namespace boost { namespace unordered { namespace detail { template rebind_alloc type; }; +#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 2 + + template + struct allocator_traits : + boost::container::allocator_traits {}; + + template + struct rebind_wrap : + boost::container::allocator_traits:: + template portable_rebind_alloc + {}; + #else // TODO: Does this match std::allocator_traits::rebind_alloc? diff --git a/test/unordered/allocator_traits.cpp b/test/unordered/allocator_traits.cpp index 777ac14e..1237426a 100644 --- a/test/unordered/allocator_traits.cpp +++ b/test/unordered/allocator_traits.cpp @@ -90,7 +90,7 @@ void test_empty_allocator() { typedef empty_allocator allocator; typedef boost::unordered::detail::allocator_traits traits; -#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 BOOST_MPL_ASSERT((boost::is_same::type>)); #else @@ -128,7 +128,7 @@ void test_allocator1() { typedef allocator1 allocator; typedef boost::unordered::detail::allocator_traits traits; -#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 BOOST_MPL_ASSERT((boost::is_same::type>)); #else diff --git a/test/unordered/minimal_allocator.cpp b/test/unordered/minimal_allocator.cpp index bce75751..8f485bc4 100644 --- a/test/unordered/minimal_allocator.cpp +++ b/test/unordered/minimal_allocator.cpp @@ -52,7 +52,7 @@ void test_simple_allocator() BOOST_MPL_ASSERT((boost::is_same)); -#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 BOOST_MPL_ASSERT((boost::is_same::type>)); #else