diff --git a/test/helpers/check_return_type.hpp b/test/helpers/check_return_type.hpp index bfcaab41..b73f9869 100644 --- a/test/helpers/check_return_type.hpp +++ b/test/helpers/check_return_type.hpp @@ -6,7 +6,7 @@ #if !defined(BOOST_UNORDERED_TEST_HELPERS_CHECK_RETURN_TYPE_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_CHECK_RETURN_TYPE_HEADER -#include +#include #include #include @@ -18,19 +18,19 @@ namespace test template static void equals(T2) { - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); } template static void equals_ref(T2&) { - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); } template static void convertible(T2) { - BOOST_MPL_ASSERT((boost::is_convertible)); + BOOST_STATIC_ASSERT((boost::is_convertible::value)); } }; } diff --git a/test/helpers/memory.hpp b/test/helpers/memory.hpp index b3638d47..a30d7522 100644 --- a/test/helpers/memory.hpp +++ b/test/helpers/memory.hpp @@ -8,10 +8,8 @@ #include #include -#include #include #include -#include #include "../helpers/test.hpp" namespace test diff --git a/test/helpers/metafunctions.hpp b/test/helpers/metafunctions.hpp index 8c8afaaa..139fe0a2 100644 --- a/test/helpers/metafunctions.hpp +++ b/test/helpers/metafunctions.hpp @@ -8,72 +8,33 @@ #include #include -#include #include #include namespace test { - /* - struct unordered_set_type { char x[100]; }; - struct unordered_multiset_type { char x[200]; }; - struct unordered_map_type { char x[300]; }; - struct unordered_multimap_type { char x[400]; }; - - template - unordered_set_type container_type( - boost::unordered_set const*); - template - unordered_multiset_type container_type( - boost::unordered_multiset const*); - template - unordered_map_type container_type( - boost::unordered_map const*); - template - unordered_multimap_type container_type( - boost::unordered_multimap const*); - */ - template struct is_set : public boost::is_same< BOOST_DEDUCED_TYPENAME Container::key_type, BOOST_DEDUCED_TYPENAME Container::value_type> {}; - template - struct is_map - : public boost::mpl::not_ > {}; - - struct yes_type { char x[100]; }; - struct no_type { char x[200]; }; - - template - yes_type has_unique_key_impl( - boost::unordered_set const*); - template - no_type has_unique_key_impl( - boost::unordered_multiset const*); - template - yes_type has_unique_key_impl( - boost::unordered_map const*); - template - no_type has_unique_key_impl( - boost::unordered_multimap const*); - template struct has_unique_keys { - BOOST_STATIC_CONSTANT(bool, value = - sizeof(has_unique_key_impl((Container const*)0)) - == sizeof(yes_type)); + BOOST_STATIC_CONSTANT(bool, value = false); }; - template - struct has_equivalent_keys + template + struct has_unique_keys > { - BOOST_STATIC_CONSTANT(bool, value = - sizeof(has_unique_key_impl((Container const*)0)) - == sizeof(no_type)); + BOOST_STATIC_CONSTANT(bool, value = true); + }; + + template + struct has_unique_keys > + { + BOOST_STATIC_CONSTANT(bool, value = true); }; } diff --git a/test/helpers/random_values.hpp b/test/helpers/random_values.hpp index 85d22c7a..18e0eae9 100644 --- a/test/helpers/random_values.hpp +++ b/test/helpers/random_values.hpp @@ -8,7 +8,7 @@ #include "./list.hpp" #include -#include +#include #include "./generators.hpp" #include "./metafunctions.hpp" @@ -81,10 +81,12 @@ namespace test template struct unordered_generator_base - : public boost::mpl::if_< - test::is_set, + : public boost::detail::if_true< + test::is_set::value + >::BOOST_NESTED_TEMPLATE then< test::unordered_generator_set, - test::unordered_generator_map > + test::unordered_generator_map + > { }; diff --git a/test/helpers/strong.hpp b/test/helpers/strong.hpp index f525faf7..02fe267a 100644 --- a/test/helpers/strong.hpp +++ b/test/helpers/strong.hpp @@ -8,7 +8,6 @@ #include #include -#include "./metafunctions.hpp" #include "./equivalent.hpp" #include "./list.hpp" #include "./exception_test.hpp" diff --git a/test/helpers/tracker.hpp b/test/helpers/tracker.hpp index fdb30815..52d9fa45 100644 --- a/test/helpers/tracker.hpp +++ b/test/helpers/tracker.hpp @@ -13,9 +13,6 @@ #include #include #include -#include -#include -#include #include #include "../objects/fwd.hpp" #include "./metafunctions.hpp" @@ -25,21 +22,17 @@ namespace test { - template - struct equals_to_compare2 - : public boost::mpl::identity< - std::less > + template + struct equals_to_compare { + typedef std::less + type; }; - template - struct equals_to_compare - : public boost::mpl::eval_if< - boost::is_same, - boost::mpl::identity, - equals_to_compare2 - > + template <> + struct equals_to_compare { + typedef test::less type; }; template @@ -67,51 +60,40 @@ namespace test values2.begin(), test::equivalent)); } - template - struct ordered_set : public - boost::mpl::if_< - test::has_unique_keys, - std::set< - BOOST_DEDUCED_TYPENAME X::value_type, - BOOST_DEDUCED_TYPENAME equals_to_compare< - BOOST_DEDUCED_TYPENAME X::key_equal - >::type - >, - std::multiset< - BOOST_DEDUCED_TYPENAME X::value_type, - BOOST_DEDUCED_TYPENAME equals_to_compare< - BOOST_DEDUCED_TYPENAME X::key_equal - >::type - > - > {}; + template + struct ordered_base; - template - struct ordered_map : public - boost::mpl::if_< - test::has_unique_keys, - std::map< - BOOST_DEDUCED_TYPENAME X::key_type, - BOOST_DEDUCED_TYPENAME X::mapped_type, - BOOST_DEDUCED_TYPENAME equals_to_compare< - BOOST_DEDUCED_TYPENAME X::key_equal - >::type - >, - std::multimap< - BOOST_DEDUCED_TYPENAME X::key_type, - BOOST_DEDUCED_TYPENAME X::mapped_type, - BOOST_DEDUCED_TYPENAME equals_to_compare< - BOOST_DEDUCED_TYPENAME X::key_equal - >::type - > - > {}; + template + struct ordered_base > + { + typedef std::set::type> + type; + }; - template - struct ordered_base : public - boost::mpl::eval_if< - test::is_set, - test::ordered_set, - test::ordered_map - > {}; + template + struct ordered_base > + { + typedef std::multiset::type> + type; + }; + + template + struct ordered_base > + { + typedef std::map::type> + type; + }; + + template + struct ordered_base > + { + typedef std::multimap::type> + type; + }; template class ordered : public ordered_base::type diff --git a/test/unordered/allocator_traits.cpp b/test/unordered/allocator_traits.cpp index 679ce96f..264c70d0 100644 --- a/test/unordered/allocator_traits.cpp +++ b/test/unordered/allocator_traits.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include // Boilerplate @@ -91,15 +91,15 @@ void test_empty_allocator() typedef empty_allocator allocator; typedef boost::unordered::detail::allocator_traits traits; #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 - BOOST_MPL_ASSERT((boost::is_same::type>)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); #else - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); #endif - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_TEST(!traits::propagate_on_container_copy_assignment::value); BOOST_TEST(!traits::propagate_on_container_move_assignment::value); BOOST_TEST(!traits::propagate_on_container_swap::value); @@ -129,15 +129,15 @@ void test_allocator1() typedef allocator1 allocator; typedef boost::unordered::detail::allocator_traits traits; #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 - BOOST_MPL_ASSERT((boost::is_same::type>)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); #else - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); #endif - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_TEST(traits::propagate_on_container_copy_assignment::value); BOOST_TEST(traits::propagate_on_container_move_assignment::value); BOOST_TEST(traits::propagate_on_container_swap::value); @@ -174,11 +174,11 @@ void test_allocator2() { typedef allocator2 allocator; typedef boost::unordered::detail::allocator_traits traits; - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_TEST(!traits::propagate_on_container_copy_assignment::value); BOOST_TEST(!traits::propagate_on_container_move_assignment::value); BOOST_TEST(!traits::propagate_on_container_swap::value); @@ -233,11 +233,11 @@ void test_allocator3() { typedef allocator3 allocator; typedef boost::unordered::detail::allocator_traits traits; - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same >)); - BOOST_MPL_ASSERT((boost::is_same >)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same >::value)); + BOOST_STATIC_ASSERT((boost::is_same >::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); BOOST_TEST(traits::propagate_on_container_copy_assignment::value); BOOST_TEST(!traits::propagate_on_container_move_assignment::value); BOOST_TEST(!traits::propagate_on_container_swap::value); diff --git a/test/unordered/compile_tests.hpp b/test/unordered/compile_tests.hpp index 255d841f..804b7ed4 100644 --- a/test/unordered/compile_tests.hpp +++ b/test/unordered/compile_tests.hpp @@ -16,8 +16,7 @@ #pragma warning(pop) #endif -#include -#include +#include #include #include #include @@ -55,42 +54,38 @@ void container_test(X& r, T const&) // value_type - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); boost::function_requires >(); // reference_type / const_reference_type - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); // iterator boost::function_requires >(); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_convertible)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_convertible::value)); // const_iterator boost::function_requires >(); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); // difference_type - BOOST_MPL_ASSERT((boost::mpl::bool_< - std::numeric_limits::is_signed>)); - BOOST_MPL_ASSERT((boost::mpl::bool_< - std::numeric_limits::is_integer>)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT(std::numeric_limits::is_signed); + BOOST_STATIC_ASSERT(std::numeric_limits::is_integer); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); // size_type - BOOST_MPL_ASSERT_NOT((boost::mpl::bool_< - std::numeric_limits::is_signed>)); - BOOST_MPL_ASSERT((boost::mpl::bool_< - std::numeric_limits::is_integer>)); + BOOST_STATIC_ASSERT(!std::numeric_limits::is_signed); + BOOST_STATIC_ASSERT(std::numeric_limits::is_integer); // size_type can represent any non-negative value type of difference_type // I'm not sure about either of these tests... @@ -184,7 +179,7 @@ void unordered_set_test(X&, Key const&) typedef BOOST_DEDUCED_TYPENAME X::value_type value_type; typedef BOOST_DEDUCED_TYPENAME X::key_type key_type; - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); } template @@ -193,8 +188,8 @@ void unordered_map_test(X& r, Key const& k, T const& v) typedef BOOST_DEDUCED_TYPENAME X::value_type value_type; typedef BOOST_DEDUCED_TYPENAME X::key_type key_type; - BOOST_MPL_ASSERT(( - boost::is_same >)); + BOOST_STATIC_ASSERT(( + boost::is_same >::value)); r.insert(std::pair(k, v)); @@ -313,36 +308,36 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq) boost::iterator_reference::type const_local_iterator_reference; - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); //boost::function_requires >(); //boost::function_requires >(); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); test::check_return_type::equals(hf(k)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); test::check_return_type::convertible(eq(k, k)); boost::function_requires >(); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); boost::function_requires< boost::InputIteratorConcept >(); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); X(10, hf, eq); X a(10, hf, eq); diff --git a/test/unordered/minimal_allocator.cpp b/test/unordered/minimal_allocator.cpp index 6f43039a..26d1323a 100644 --- a/test/unordered/minimal_allocator.cpp +++ b/test/unordered/minimal_allocator.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include "../objects/test.hpp" template @@ -41,22 +41,22 @@ void test_simple_allocator() typedef boost::unordered::detail::allocator_traits< SimpleAllocator > traits; - BOOST_MPL_ASSERT((boost::is_same >)); + BOOST_STATIC_ASSERT((boost::is_same >::value)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_MPL_ASSERT((boost::is_same)); - BOOST_MPL_ASSERT((boost::is_same)); - //BOOST_MPL_ASSERT((boost::is_same)); - //BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + //BOOST_STATIC_ASSERT((boost::is_same::value)); + //BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 - BOOST_MPL_ASSERT((boost::is_same::type>)); + BOOST_STATIC_ASSERT((boost::is_same::type>::value)); #else - BOOST_MPL_ASSERT((boost::is_same)); + BOOST_STATIC_ASSERT((boost::is_same::value)); #endif BOOST_TEST(!traits::propagate_on_container_copy_assignment::value); diff --git a/test/unordered/move_tests.cpp b/test/unordered/move_tests.cpp index 85159926..164eb88d 100644 --- a/test/unordered/move_tests.cpp +++ b/test/unordered/move_tests.cpp @@ -162,12 +162,12 @@ namespace move_tests #elif defined(BOOST_HAS_NRVO) BOOST_TEST( test::global_object_count.constructions - count.constructions <= - (test::is_map::value ? 50 : 25)); + (test::is_set::value ? 25 : 50)); BOOST_TEST(count.instances == test::global_object_count.instances); #else BOOST_TEST( test::global_object_count.constructions - count.constructions <= - (test::is_map::value ? 100 : 50)); + (test::is_set::value ? 50 : 100)); BOOST_TEST(count.instances == test::global_object_count.instances); #endif test::check_container(y, v);