diff --git a/include/boost/unordered/detail/allocator_helpers.hpp b/include/boost/unordered/detail/allocator_helpers.hpp index e770960e..dbba5046 100644 --- a/include/boost/unordered/detail/allocator_helpers.hpp +++ b/include/boost/unordered/detail/allocator_helpers.hpp @@ -26,6 +26,10 @@ #include #include +#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS) +#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0 +#endif + #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS # include #endif @@ -198,7 +202,8 @@ namespace boost { namespace unordered { namespace detail { template struct rebind_wrap { - typedef typename std::allocator_traits::rebind_alloc type; + typedef typename std::allocator_traits:: + template rebind_alloc type; }; #else diff --git a/include/boost/unordered/detail/extract_key.hpp b/include/boost/unordered/detail/extract_key.hpp index 6cc4a23e..4ca13e8c 100644 --- a/include/boost/unordered/detail/extract_key.hpp +++ b/include/boost/unordered/detail/extract_key.hpp @@ -51,13 +51,6 @@ namespace detail { return v; } -#if BOOST_UNORDERED_USE_RV_REF - static key_type const& extract(BOOST_RV_REF(key_type) v) - { - return v; - } -#endif - static no_key extract() { return no_key(); @@ -69,7 +62,6 @@ namespace detail { { return no_key(); } - #else template static no_key extract(Arg const&) @@ -106,13 +98,6 @@ namespace detail { return v; } - // TODO: Why does this cause errors? - // - //static key_type const& extract(BOOST_RV_REF(key_type) v) - //{ - // return v; - //} - template static key_type const& extract(std::pair const& v) { diff --git a/test/objects/minimal.hpp b/test/objects/minimal.hpp index 4c7118b6..f0b7bdcf 100644 --- a/test/objects/minimal.hpp +++ b/test/objects/minimal.hpp @@ -333,7 +333,7 @@ namespace minimal typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef void_ptr void_pointer; - typedef void_const_ptr void_const_pointer; + typedef void_const_ptr const_void_pointer; typedef ptr pointer; typedef const_ptr const_pointer; typedef T& reference; diff --git a/test/unordered/Jamfile.v2 b/test/unordered/Jamfile.v2 index 51c94f48..4a785224 100644 --- a/test/unordered/Jamfile.v2 +++ b/test/unordered/Jamfile.v2 @@ -9,6 +9,8 @@ project unordered-test/unordered : requirements all intel:on + # Would be nice to define -Wundef, but I'm getting warnings from + # Boost.Preprocessor on trunk. gcc:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wno-long-long" darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion" #gcc:_GLIBCXX_DEBUG diff --git a/test/unordered/allocator_traits.cpp b/test/unordered/allocator_traits.cpp index ba8ac0d8..ef7f61fe 100644 --- a/test/unordered/allocator_traits.cpp +++ b/test/unordered/allocator_traits.cpp @@ -90,7 +90,12 @@ void test_empty_allocator() { typedef empty_allocator allocator; typedef boost::unordered::detail::allocator_traits traits; +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS + BOOST_MPL_ASSERT((boost::is_same::type>)); +#else BOOST_MPL_ASSERT((boost::is_same)); +#endif BOOST_MPL_ASSERT((boost::is_same)); BOOST_MPL_ASSERT((boost::is_same)); BOOST_MPL_ASSERT((boost::is_same)); @@ -123,7 +128,12 @@ void test_allocator1() { typedef allocator1 allocator; typedef boost::unordered::detail::allocator_traits traits; +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS + BOOST_MPL_ASSERT((boost::is_same::type>)); +#else BOOST_MPL_ASSERT((boost::is_same)); +#endif BOOST_MPL_ASSERT((boost::is_same)); BOOST_MPL_ASSERT((boost::is_same)); BOOST_MPL_ASSERT((boost::is_same)); @@ -186,6 +196,20 @@ struct ptr T& operator*() const { return *value_; } }; +template <> +struct ptr +{ + void* value_; + ptr(void* v) : value_(v) {} +}; + +template <> +struct ptr +{ + void const* value_; + ptr(void const* v) : value_(v) {} +}; + template struct allocator3 { diff --git a/test/unordered/compile_tests.hpp b/test/unordered/compile_tests.hpp index b82eadb8..255d841f 100644 --- a/test/unordered/compile_tests.hpp +++ b/test/unordered/compile_tests.hpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "../helpers/check_return_type.hpp" typedef long double comparison_type; diff --git a/test/unordered/minimal_allocator.cpp b/test/unordered/minimal_allocator.cpp index 7904ae9f..bce75751 100644 --- a/test/unordered/minimal_allocator.cpp +++ b/test/unordered/minimal_allocator.cpp @@ -51,7 +51,13 @@ void test_simple_allocator() //BOOST_MPL_ASSERT((boost::is_same)); BOOST_MPL_ASSERT((boost::is_same)); + +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS + BOOST_MPL_ASSERT((boost::is_same::type>)); +#else BOOST_MPL_ASSERT((boost::is_same)); +#endif BOOST_TEST(!traits::propagate_on_container_copy_assignment::value); BOOST_TEST(!traits::propagate_on_container_move_assignment::value);