diff --git a/include/boost/unordered/detail/buckets.hpp b/include/boost/unordered/detail/buckets.hpp index e5c754ec..47ee4659 100644 --- a/include/boost/unordered/detail/buckets.hpp +++ b/include/boost/unordered/detail/buckets.hpp @@ -549,6 +549,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std) BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) #endif +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) template struct emulation1 { static choice1::type check(choice1, std::pair const&); @@ -556,45 +557,58 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) enum { value = sizeof(check(choose(), make())) == sizeof(choice2::type) }; }; +#endif +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) template - struct piecewise3 { + struct check3_base { static choice1::type check(choice1, boost::unordered::piecewise_construct_t); static choice2::type check(choice2, A const&); static choice3::type check(choice3, ...); + }; +#else + template + struct check3_base { + static choice1::type check(choice1, boost::unordered::piecewise_construct_t); + static choice3::type check(choice3, ...); + }; +#endif - enum { value = sizeof(check(choose(), make())) == sizeof(choice1::type) }; + template + struct piecewise3 { + enum { value = + sizeof(check3_base::check(choose(), make())) == + sizeof(choice1::type) }; }; template struct emulation3 { - static choice1::type check(choice1, boost::unordered::piecewise_construct_t); - static choice2::type check(choice2, A const&); - static choice3::type check(choice3, ...); - - enum { value = sizeof(check(choose(), make())) == sizeof(choice2::type) }; + enum { value = + sizeof(check3_base::check(choose(), make())) == + sizeof(choice2::type) }; }; template struct normal3 { - static choice1::type check(choice1, boost::unordered::piecewise_construct_t); - static choice2::type check(choice2, A const&); - static choice3::type check(choice3, ...); - - enum { value = sizeof(check(choose(), make())) == sizeof(choice3::type) }; + enum { value = + sizeof(check3_base::check(choose(), make())) == + sizeof(choice3::type) }; }; template struct pair_construct1 {}; + template + struct normal_construct1 { typedef void type; }; + +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) template struct pair_construct1, Arg1> : enable_if, void> {}; - template - struct normal_construct1 { typedef void type; }; template struct normal_construct1, Arg1> : disable_if, void> {}; +#endif template struct piecewise_construct3 {}; @@ -616,13 +630,15 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::tr1) template struct pair_construct_n {}; - template - struct pair_construct_n > { typedef void type; }; - template struct normal_construct_n { typedef void type; }; + +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) + template + struct pair_construct_n > { typedef void type; }; template struct normal_construct_n > {}; +#endif template inline void construct_impl(void* address) diff --git a/test/unordered/Jamfile.v2 b/test/unordered/Jamfile.v2 index 86fc0221..03d8ef9c 100644 --- a/test/unordered/Jamfile.v2 +++ b/test/unordered/Jamfile.v2 @@ -35,6 +35,9 @@ test-suite unordered [ run move_tests.cpp ] [ run assign_tests.cpp ] [ run insert_tests.cpp ] + [ run insert_tests.cpp : : + : BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT + : insert_deprecated ] [ run insert_stable_tests.cpp ] [ run unnecessary_copy_tests.cpp ] [ run erase_tests.cpp ] diff --git a/test/unordered/insert_tests.cpp b/test/unordered/insert_tests.cpp index bc4b70cc..54cca259 100644 --- a/test/unordered/insert_tests.cpp +++ b/test/unordered/insert_tests.cpp @@ -545,14 +545,15 @@ UNORDERED_AUTO_TEST(map_emplace_test) BOOST_TEST(x.find(0) != x.end() && x.find(0)->second == overloaded_constructor()); - x.emplace(1); - BOOST_TEST(x.find(1) != x.end() && - x.find(1)->second == overloaded_constructor()); - x.emplace(2, 3); BOOST_TEST(x.find(2) != x.end() && x.find(2)->second == overloaded_constructor(3)); +#if defined (BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) + x.emplace(1); + BOOST_TEST(x.find(1) != x.end() && + x.find(1)->second == overloaded_constructor()); + x.emplace(4, 5, 6); BOOST_TEST(x.find(4) != x.end() && x.find(4)->second == overloaded_constructor(5, 6)); @@ -560,6 +561,7 @@ UNORDERED_AUTO_TEST(map_emplace_test) x.emplace(7, 8, 9, 10); BOOST_TEST(x.find(7) != x.end() && x.find(7)->second == overloaded_constructor(8, 9, 10)); +#endif } UNORDERED_AUTO_TEST(set_emplace_test)