diff --git a/doc/changes.qbk b/doc/changes.qbk index f4e42f63..910c7850 100644 --- a/doc/changes.qbk +++ b/doc/changes.qbk @@ -220,4 +220,12 @@ C++11 support has resulted in some breaking changes: for C++11 allocators. * Simplified the implementation a bit. Hopefully more robust. +[h2 Boost 1.53.0] + +* Remove support for the old pre-standard variadic pair constructors, and + equality implementation. Both have been deprecated since Boost 1.48. +* Remove use of deprecated config macros. +* More internal implementation changes, including a much simpler + implementation of `erase`. + [endsect] diff --git a/doc/ref.php b/doc/ref.php index 2971b5df..0a474807 100644 --- a/doc/ref.php +++ b/doc/ref.php @@ -449,10 +449,6 @@ EOL; Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -499,10 +495,6 @@ EOL; Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -1114,9 +1106,7 @@ EOL; The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -1157,9 +1147,7 @@ EOL; The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. diff --git a/doc/ref.xml b/doc/ref.xml index 9cbe0316..f16e6028 100644 --- a/doc/ref.xml +++ b/doc/ref.xml @@ -383,10 +383,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -426,10 +422,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -970,9 +962,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -1005,9 +995,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -1429,10 +1417,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -1472,10 +1456,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -2014,9 +1994,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -2049,9 +2027,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -2488,10 +2464,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -2531,10 +2503,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -3108,9 +3076,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -3145,9 +3111,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -3581,10 +3545,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -3624,10 +3584,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Since existing std::pair implementations don't support std::piecewise_construct this emulates it, but using boost::unordered::piecewise_construct. - In version of Boost before 1.48 this emulated the variadic pair - constructor from older C++0x drafts. For backwards compatability - this can be enabled by defining the macro - BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT. @@ -4168,9 +4124,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. @@ -4205,9 +4159,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) The behavior of this function was changed to match - the C++11 standard in Boost 1.48. If you wish to use - the old behaviour, define the macro - BOOST_UNORDERED_DEPRECATED_EQUALITY. + the C++11 standard in Boost 1.48. Behavior is undefined if the two containers don't have equivalent equality predicates. diff --git a/include/boost/unordered/detail/allocate.hpp b/include/boost/unordered/detail/allocate.hpp index b6f1c796..e07c7082 100644 --- a/include/boost/unordered/detail/allocate.hpp +++ b/include/boost/unordered/detail/allocate.hpp @@ -85,7 +85,7 @@ namespace boost { namespace unordered { namespace detail { // Either forwarding variadic arguments, or storing the arguments in // emplace_args##n -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define BOOST_UNORDERED_EMPLACE_TEMPLATE typename... Args #define BOOST_UNORDERED_EMPLACE_ARGS BOOST_FWD_REF(Args)... args @@ -136,7 +136,7 @@ namespace boost { namespace unordered { namespace detail { #define BOOST_UNORDERED_EMPLACE_ARGS2 create_emplace_args #define BOOST_UNORDERED_EMPLACE_ARGS3 create_emplace_args -#if defined(BOOST_NO_RVALUE_REFERENCES) +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \ typedef BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(Arg, n); \ @@ -342,7 +342,7 @@ namespace boost { namespace unordered { namespace detail { # include # endif -# if !defined(BOOST_NO_VARIADIC_TEMPLATES) && \ +# if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ !defined(BOOST_NO_SFINAE_EXPR) # define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 1 # else @@ -432,7 +432,7 @@ namespace boost { namespace unordered { namespace detail { max_size, U const, (), 0 ); -# if !defined(BOOST_NO_VARIADIC_TEMPLATES) +# if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template BOOST_UNORDERED_HAS_FUNCTION( @@ -763,7 +763,7 @@ namespace boost { namespace unordered { namespace detail { //////////////////////////////////////////////////////////////////////////// // call_construct -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) # if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT @@ -812,7 +812,7 @@ namespace boost { namespace unordered { namespace detail { // // Used for piecewise construction. -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) # define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \ template \ @@ -921,62 +921,26 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) #endif //////////////////////////////////////////////////////////////////////////// - // SFINAE traits for construction. + // Trait to check for piecewise construction. - // Decide which construction method to use for a three argument - // call. Note that this is difficult to do using overloads because - // the arguments are packed into 'emplace_args3'. - // - // The decision is made on the first argument. - - -#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) - template - struct emulation1 { - static choice1::type test(choice1, std::pair const&); - static choice2::type test(choice2, A const&); - static choice3::type test(choice3, convert_from_anything const&); - - enum { value = - sizeof(test(choose(), boost::unordered::detail::make())) == - sizeof(choice2::type) }; - }; -#endif - - template - struct check3_base { + template + struct use_piecewise { static choice1::type test(choice1, boost::unordered::piecewise_construct_t); -#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) - static choice2::type test(choice2, A const&); -#endif + static choice2::type test(choice2, ...); - static choice3::type test(choice3, ...); - - enum { value = + enum { value = sizeof(choice1::type) == sizeof(test(choose(), boost::unordered::detail::make())) }; }; - template - struct piecewise3 { - enum { value = check3_base::value == sizeof(choice1::type) }; - }; - -#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) - template - struct emulation3 { - enum { value = check3_base::value == sizeof(choice2::type) }; - }; - -#endif - -// TODO: Full construct? -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) //////////////////////////////////////////////////////////////////////////// // Construct from variadic parameters + // For the standard pair constructor. + template inline void construct_value_impl(Alloc& alloc, T* address, BOOST_FWD_REF(Args)... args) @@ -985,9 +949,14 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) address, boost::forward(args)...); } + // Special case for piece_construct + // + // TODO: When possible, it might be better to use std::pair's + // constructor for std::piece_construct with std::tuple. + template - inline typename enable_if, void>::type + inline typename enable_if, void>::type construct_value_impl(Alloc& alloc, std::pair* address, BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) { @@ -997,70 +966,13 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) boost::addressof(address->second), boost::forward(a2)); } -#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) - - template - inline typename enable_if, void>::type - construct_value_impl(Alloc& alloc, std::pair* address, - BOOST_FWD_REF(A0) a0) - { - boost::unordered::detail::call_construct(alloc, - boost::addressof(address->first),boost::forward(a0)); - boost::unordered::detail::call_construct(alloc, - boost::addressof(address->second)); - } - - template - inline typename enable_if, void>::type - construct_value_impl(Alloc& alloc, std::pair* address, - BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) - { - boost::unordered::detail::call_construct(alloc, - boost::addressof(address->first),boost::forward(a0)); - boost::unordered::detail::call_construct(alloc, - boost::addressof(address->second), - boost::forward(a1), - boost::forward(a2)); - } - - template - inline void construct_value_impl(Alloc& alloc, std::pair* address, - BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, - BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(Args)... args) - { - boost::unordered::detail::call_construct(alloc, - boost::addressof(address->first),boost::forward(a0)); - boost::unordered::detail::call_construct(alloc, - boost::addressof(address->second), - boost::forward(a1), - boost::forward(a2), - boost::forward(a3), - boost::forward(args)...); - } - -#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT -#else // BOOST_NO_VARIADIC_TEMPLATES +#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES //////////////////////////////////////////////////////////////////////////////// // Construct from emplace_args -#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \ - template < \ - typename Alloc, typename T, \ - BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A) \ - > \ - inline void construct_value_impl(Alloc&, T* address, \ - boost::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \ - BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \ - > const& args) \ - { \ - new((void*) address) T( \ - BOOST_PP_ENUM_##z(num_params, BOOST_UNORDERED_CALL_FORWARD, \ - args.a)); \ - } + // Explicitly write out first three overloads for the sake of sane + // error messages. template inline void construct_value_impl(Alloc&, T* address, @@ -1090,16 +1002,35 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) ); } + // Use a macro for the rest. + +#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \ + template < \ + typename Alloc, typename T, \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A) \ + > \ + inline void construct_value_impl(Alloc&, T* address, \ + boost::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \ + > const& args) \ + { \ + new((void*) address) T( \ + BOOST_PP_ENUM_##z(num_params, BOOST_UNORDERED_CALL_FORWARD, \ + args.a)); \ + } + BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT, BOOST_UNORDERED_CONSTRUCT_IMPL, _) #undef BOOST_UNORDERED_CONSTRUCT_IMPL + // Construct with piece_construct + template inline void construct_value_impl(Alloc& alloc, std::pair* address, boost::unordered::detail::emplace_args3 const& args, - typename enable_if, void*>::type = 0) + typename enable_if, void*>::type = 0) { boost::unordered::detail::construct_from_tuple(alloc, boost::addressof(address->first), args.a1); @@ -1107,59 +1038,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) boost::addressof(address->second), args.a2); } -#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) - - template - inline void construct_value_impl(Alloc&, std::pair* address, - boost::unordered::detail::emplace_args1 const& args, - typename enable_if, void*>::type = 0) - { - new((void*) boost::addressof(address->first)) A( - boost::forward(args.a0)); - new((void*) boost::addressof(address->second)) B(); - } - - template - inline void construct_value_impl(Alloc&, std::pair* address, - boost::unordered::detail::emplace_args3 const& args, - typename enable_if, void*>::type = 0) - { - new((void*) boost::addressof(address->first)) A( - boost::forward(args.a0)); - new((void*) boost::addressof(address->second)) B( - boost::forward(args.a1), - boost::forward(args.a2)); - } - -#define BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL(z, num_params, _) \ - template \ - inline void construct_value_impl(Alloc&, std::pair* address, \ - boost::unordered::detail::BOOST_PP_CAT(emplace_args, num_params) < \ - BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \ - > const& args) \ - { \ - new((void*) boost::addressof(address->first)) A( \ - boost::forward(args.a0)); \ - new((void*) boost::addressof(address->second)) B( \ - BOOST_PP_ENUM_##z(BOOST_PP_DEC(num_params), \ - BOOST_UNORDERED_CALL_FORWARD2, args.a)); \ - } - -#define BOOST_UNORDERED_CALL_FORWARD2(z, i, a) \ - BOOST_UNORDERED_CALL_FORWARD(z, BOOST_PP_INC(i), a) - - BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL(1, 2, _) - BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL, _) - -#undef BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL -#undef BOOST_UNORDERED_CALL_FORWARD2 - -#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT -#endif // BOOST_NO_VARIADIC_TEMPLATES +#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES }}} diff --git a/include/boost/unordered/detail/buckets.hpp b/include/boost/unordered/detail/buckets.hpp index ed7f5e01..39f7df0f 100644 --- a/include/boost/unordered/detail/buckets.hpp +++ b/include/boost/unordered/detail/buckets.hpp @@ -777,7 +777,7 @@ namespace boost { namespace unordered { namespace detail { // rvalue parameters when type can't be a BOOST_RV_REF(T) parameter // e.g. for int -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) # define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T) #else struct please_ignore_this_overload { diff --git a/include/boost/unordered/detail/equivalent.hpp b/include/boost/unordered/detail/equivalent.hpp index bd3d7588..d1c688b8 100644 --- a/include/boost/unordered/detail/equivalent.hpp +++ b/include/boost/unordered/detail/equivalent.hpp @@ -302,8 +302,6 @@ namespace boost { namespace unordered { namespace detail { return true; } -#if !defined(BOOST_UNORDERED_DEPRECATED_EQUALITY) - static bool group_equals(iterator n1, iterator end1, iterator n2, iterator end2) { @@ -364,26 +362,6 @@ namespace boost { namespace unordered { namespace detail { return count; } -#else - - static bool group_equals(iterator n1, iterator end1, - iterator n2, iterator end2) - { - for(;;) - { - if(!extractor::compare_mapped(*n1, *n2)) - return false; - - ++n1; - ++n2; - - if (n1 == end1) return n2 == end2; - if (n2 == end2) return false; - } - } - -#endif - // Emplace/Insert static inline void add_after_node( @@ -460,8 +438,8 @@ namespace boost { namespace unordered { namespace detail { this->add_node(a, key_hash, this->find_node(key_hash, k)); } -#if defined(BOOST_NO_RVALUE_REFERENCES) -# if defined(BOOST_NO_VARIADIC_TEMPLATES) +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +# if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) iterator emplace(boost::unordered::detail::emplace_args1< boost::unordered::detail::please_ignore_this_overload> const&) { diff --git a/include/boost/unordered/detail/extract_key.hpp b/include/boost/unordered/detail/extract_key.hpp index 66e039d0..60943d9b 100644 --- a/include/boost/unordered/detail/extract_key.hpp +++ b/include/boost/unordered/detail/extract_key.hpp @@ -56,7 +56,7 @@ namespace detail { return no_key(); } -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template static no_key extract(Args const&...) { @@ -75,11 +75,6 @@ namespace detail { return no_key(); } #endif - - static bool compare_mapped(value_type const&, value_type const&) - { - return true; - } }; template @@ -93,11 +88,6 @@ namespace detail { return v.first; } - static key_type const& extract(key_type const& v) - { - return v; - } - template static key_type const& extract(std::pair const& v) { @@ -111,14 +101,13 @@ namespace detail { return v.first; } -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) - template - static key_type const& extract(key_type const& k, - Arg1 const&, Args const&...) + template + static key_type const& extract(key_type const& k, Arg1 const&) { return k; } +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template static no_key extract(Args const&...) { @@ -126,12 +115,6 @@ namespace detail { } #else - template - static key_type const& extract(key_type const& k, Arg1 const&) - { - return k; - } - static no_key extract() { return no_key(); @@ -150,12 +133,12 @@ namespace detail { } #endif -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \ template \ static no_key extract(boost::unordered::piecewise_construct_t, \ - namespace_ tuple<> const&, BOOST_FWD_REF(T2)) \ + namespace_ tuple<> const&, T2 const&) \ { \ return no_key(); \ } \ @@ -163,7 +146,7 @@ namespace detail { template \ static typename is_key::type \ extract(boost::unordered::piecewise_construct_t, \ - namespace_ tuple const& k, BOOST_FWD_REF(T2)) \ + namespace_ tuple const& k, T2 const&) \ { \ return typename is_key::type( \ namespace_ get<0>(k)); \ @@ -194,12 +177,6 @@ BOOST_UNORDERED_KEY_FROM_TUPLE(boost::) #if !defined(BOOST_NO_CXX11_HDR_TUPLE) BOOST_UNORDERED_KEY_FROM_TUPLE(std::) #endif - - - static bool compare_mapped(value_type const& x, value_type const& y) - { - return x.second == y.second; - } }; }}} diff --git a/include/boost/unordered/detail/table.hpp b/include/boost/unordered/detail/table.hpp index 48319581..a0b14c0c 100644 --- a/include/boost/unordered/detail/table.hpp +++ b/include/boost/unordered/detail/table.hpp @@ -18,6 +18,18 @@ #pragma warning(disable:4127) // conditional expression is constant #endif +#if defined(BOOST_UNORDERED_DEPRECATED_EQUALITY) + +#if defined(__EDG__) +#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +#pragma message("Warning: BOOST_UNORDERED_DEPRECATED_EQUALITY is no longer supported.") +#elif defined(__GNUC__) || defined(__HP_aCC) || \ + defined(__SUNPRO_CC) || defined(__IBMCPP__) +#warning "BOOST_UNORDERED_DEPRECATED_EQUALITY is no longer supported." +#endif + +#endif + namespace boost { namespace unordered { namespace detail { //////////////////////////////////////////////////////////////////////////// diff --git a/include/boost/unordered/detail/unique.hpp b/include/boost/unordered/detail/unique.hpp index 9712eff3..4ea071b2 100644 --- a/include/boost/unordered/detail/unique.hpp +++ b/include/boost/unordered/detail/unique.hpp @@ -290,13 +290,8 @@ namespace boost { namespace unordered { namespace detail { { iterator n2 = other.find_matching_node(n1); -#if !defined(BOOST_UNORDERED_DEPRECATED_EQUALITY) if (!n2.node_ || *n1 != *n2) return false; -#else - if (!n2.node_ || !extractor::compare_mapped(*n1, *n2)) - return false; -#endif } return true; @@ -358,8 +353,8 @@ namespace boost { namespace unordered { namespace detail { return *add_node(a, key_hash); } -#if defined(BOOST_NO_RVALUE_REFERENCES) -# if defined(BOOST_NO_VARIADIC_TEMPLATES) +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +# if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) emplace_return emplace(boost::unordered::detail::emplace_args1< boost::unordered::detail::please_ignore_this_overload> const&) { @@ -379,7 +374,7 @@ namespace boost { namespace unordered { namespace detail { template emplace_return emplace(BOOST_UNORDERED_EMPLACE_ARGS) { -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) return emplace_impl( extractor::extract(BOOST_UNORDERED_EMPLACE_FORWARD), BOOST_UNORDERED_EMPLACE_FORWARD); @@ -390,7 +385,7 @@ namespace boost { namespace unordered { namespace detail { #endif } -#if defined(BOOST_NO_VARIADIC_TEMPLATES) +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template emplace_return emplace( boost::unordered::detail::emplace_args1 const& args) diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 651fefaa..33449d9c 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -120,14 +120,14 @@ namespace unordered : table_(other.table_, boost::unordered::detail::move_tag()) { } -#elif !defined(BOOST_NO_RVALUE_REFERENCES) +#elif !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_map(unordered_map&& other) : table_(other.table_, boost::unordered::detail::move_tag()) { } #endif -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_map(unordered_map&&, allocator_type const&); #endif @@ -165,7 +165,7 @@ namespace unordered return *this; } -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_map& operator=(unordered_map&& x) { table_.move_assign(x.table_); @@ -231,7 +231,7 @@ namespace unordered // emplace -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template std::pair emplace(BOOST_FWD_REF(Args)... args) { @@ -601,14 +601,14 @@ namespace unordered : table_(other.table_, boost::unordered::detail::move_tag()) { } -#elif !defined(BOOST_NO_RVALUE_REFERENCES) +#elif !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_multimap(unordered_multimap&& other) : table_(other.table_, boost::unordered::detail::move_tag()) { } #endif -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_multimap(unordered_multimap&&, allocator_type const&); #endif @@ -647,7 +647,7 @@ namespace unordered return *this; } -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_multimap& operator=(unordered_multimap&& x) { table_.move_assign(x.table_); @@ -713,7 +713,7 @@ namespace unordered // emplace -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template iterator emplace(BOOST_FWD_REF(Args)... args) { @@ -1066,7 +1066,7 @@ namespace unordered { } -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template unordered_map::unordered_map( @@ -1399,7 +1399,7 @@ namespace unordered { } -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template unordered_multimap::unordered_multimap( diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index b0a2a852..6787a3a3 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -118,14 +118,14 @@ namespace unordered : table_(other.table_, boost::unordered::detail::move_tag()) { } -#elif !defined(BOOST_NO_RVALUE_REFERENCES) +#elif !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_set(unordered_set&& other) : table_(other.table_, boost::unordered::detail::move_tag()) { } #endif -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_set(unordered_set&&, allocator_type const&); #endif @@ -163,7 +163,7 @@ namespace unordered return *this; } -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_set& operator=(unordered_set&& x) { table_.move_assign(x.table_); @@ -229,7 +229,7 @@ namespace unordered // emplace -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template std::pair emplace(BOOST_FWD_REF(Args)... args) { @@ -585,14 +585,14 @@ namespace unordered : table_(other.table_, boost::unordered::detail::move_tag()) { } -#elif !defined(BOOST_NO_RVALUE_REFERENCES) +#elif !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_multiset(unordered_multiset&& other) : table_(other.table_, boost::unordered::detail::move_tag()) { } #endif -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_multiset(unordered_multiset&&, allocator_type const&); #endif @@ -631,7 +631,7 @@ namespace unordered return *this; } -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) unordered_multiset& operator=(unordered_multiset&& x) { table_.move_assign(x.table_); @@ -697,7 +697,7 @@ namespace unordered // emplace -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template iterator emplace(BOOST_FWD_REF(Args)... args) { @@ -1041,7 +1041,7 @@ namespace unordered { } -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template unordered_set::unordered_set( @@ -1325,7 +1325,7 @@ namespace unordered { } -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template unordered_multiset::unordered_multiset( diff --git a/test/exception/insert_exception_tests.cpp b/test/exception/insert_exception_tests.cpp index 464a0ff5..3b909d13 100644 --- a/test/exception/insert_exception_tests.cpp +++ b/test/exception/insert_exception_tests.cpp @@ -37,7 +37,7 @@ struct insert_test_base : public test::exception_base } }; -#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template struct emplace_test1 : public insert_test_base @@ -236,7 +236,7 @@ struct insert_test_rehash3 : public insert_test_base (insert_test1)(insert_test2)(insert_test3)(insert_test4) \ (insert_test_rehash1)(insert_test_rehash2)(insert_test_rehash3) -#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define ALL_TESTS (emplace_test1)BASIC_TESTS #else #define ALL_TESTS BASIC_TESTS diff --git a/test/objects/cxx11_allocator.hpp b/test/objects/cxx11_allocator.hpp index bd707734..8b4e8db9 100644 --- a/test/objects/cxx11_allocator.hpp +++ b/test/objects/cxx11_allocator.hpp @@ -170,7 +170,7 @@ namespace test new(p) T(t); } -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template void construct(T* p, BOOST_FWD_REF(Args)... args) { detail::tracker.track_construct((void*) p, sizeof(T), tag_); new(p) T(boost::forward(args)...); diff --git a/test/objects/exception.hpp b/test/objects/exception.hpp index 4d7d872a..28d4d5b4 100644 --- a/test/objects/exception.hpp +++ b/test/objects/exception.hpp @@ -348,7 +348,7 @@ namespace exception test::detail::tracker.track_construct((void*) p, sizeof(T), tag_); } -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template void construct(T* p, BOOST_FWD_REF(Args)... args) { UNORDERED_SCOPE(allocator::construct(pointer, BOOST_FWD_REF(Args)...)) { UNORDERED_EPOINT("Mock allocator construct function."); @@ -528,7 +528,7 @@ namespace exception test::detail::tracker.track_construct((void*) p, sizeof(T), tag_); } -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template void construct(T* p, BOOST_FWD_REF(Args)... args) { UNORDERED_SCOPE(allocator2::construct(pointer, BOOST_FWD_REF(Args)...)) { UNORDERED_EPOINT("Mock allocator2 construct function."); diff --git a/test/objects/minimal.hpp b/test/objects/minimal.hpp index ba32167a..af7d0387 100644 --- a/test/objects/minimal.hpp +++ b/test/objects/minimal.hpp @@ -155,7 +155,7 @@ namespace minimal ~movable1() {} }; -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) class movable2 { public: @@ -371,7 +371,7 @@ namespace minimal void construct(T* p, T const& t) { new((void*)p) T(t); } -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template void construct(T* p, BOOST_FWD_REF(Args)... args) { new((void*)p) T(boost::forward(args)...); } @@ -443,7 +443,7 @@ namespace minimal void construct(T* p, T const& t) { new((void*)p) T(t); } -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template void construct(T* p, BOOST_FWD_REF(Args)... args) { new((void*)p) T(boost::forward(args)...); } diff --git a/test/objects/test.hpp b/test/objects/test.hpp index 13462350..1c2a24ab 100644 --- a/test/objects/test.hpp +++ b/test/objects/test.hpp @@ -591,7 +591,7 @@ namespace test new(p) T(t); } -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template void construct(T* p, BOOST_FWD_REF(Args)... args) { detail::tracker.track_construct((void*) p, sizeof(T), tag_); new(p) T(boost::forward(args)...); diff --git a/test/unordered/Jamfile.v2 b/test/unordered/Jamfile.v2 index 77206493..581e4ee0 100644 --- a/test/unordered/Jamfile.v2 +++ b/test/unordered/Jamfile.v2 @@ -34,9 +34,6 @@ 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 ] @@ -47,7 +44,6 @@ test-suite unordered [ run load_factor_tests.cpp ] [ run rehash_tests.cpp ] [ run equality_tests.cpp ] - [ run equality_deprecated.cpp ] [ run swap_tests.cpp ] [ run compile_set.cpp : : diff --git a/test/unordered/compile_tests.hpp b/test/unordered/compile_tests.hpp index 804b7ed4..02ef78aa 100644 --- a/test/unordered/compile_tests.hpp +++ b/test/unordered/compile_tests.hpp @@ -137,7 +137,7 @@ void unordered_destructible_test(X&) X x1; -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) X x2(rvalue_default()); X x3 = rvalue_default(); // This can only be done if propagate_on_container_move_assignment::value @@ -453,7 +453,7 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq) typedef BOOST_DEDUCED_TYPENAME X::iterator iterator; typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator; -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) X x1(rvalue_default()); X x2(boost::move(x1)); x1 = rvalue_default(); diff --git a/test/unordered/equality_deprecated.cpp b/test/unordered/equality_deprecated.cpp deleted file mode 100644 index af56bdea..00000000 --- a/test/unordered/equality_deprecated.cpp +++ /dev/null @@ -1,174 +0,0 @@ - -// Copyright 2008-2009 Daniel James. -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#define BOOST_UNORDERED_DEPRECATED_EQUALITY - -#include "../helpers/prefix.hpp" -#include -#include -#include "../helpers/postfix.hpp" - -#include -#include -#include "../helpers/test.hpp" - -namespace equality_tests -{ - struct mod_compare - { - bool alt_hash_; - - explicit mod_compare(bool alt_hash = false) : alt_hash_(alt_hash) {} - - bool operator()(int x, int y) const - { - return x % 1000 == y % 1000; - } - - int operator()(int x) const - { - return alt_hash_ ? x % 250 : (x + 5) % 250; - } - }; - -#define UNORDERED_EQUALITY_SET_TEST(seq1, op, seq2) \ - { \ - boost::unordered_set set1, set2; \ - BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \ - BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \ - BOOST_TEST(set1 op set2); \ - } - -#define UNORDERED_EQUALITY_MULTISET_TEST(seq1, op, seq2) \ - { \ - boost::unordered_multiset \ - set1, set2; \ - BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \ - BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \ - BOOST_TEST(set1 op set2); \ - } - -#define UNORDERED_EQUALITY_MAP_TEST(seq1, op, seq2) \ - { \ - boost::unordered_map \ - map1, map2; \ - BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map1, seq1) \ - BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map2, seq2) \ - BOOST_TEST(map1 op map2); \ - } - -#define UNORDERED_EQUALITY_MULTIMAP_TEST(seq1, op, seq2) \ - { \ - boost::unordered_multimap \ - map1, map2; \ - BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map1, seq1) \ - BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map2, seq2) \ - BOOST_TEST(map1 op map2); \ - } - -#define UNORDERED_SET_INSERT(r, set, item) set.insert(item); -#define UNORDERED_MAP_INSERT(r, map, item) \ - map.insert(std::pair BOOST_PP_SEQ_TO_TUPLE(item)); - - UNORDERED_AUTO_TEST(equality_size_tests) - { - boost::unordered_set x1, x2; - BOOST_TEST(x1 == x2); - BOOST_TEST(!(x1 != x2)); - - x1.insert(1); - BOOST_TEST(x1 != x2); - BOOST_TEST(!(x1 == x2)); - BOOST_TEST(x2 != x1); - BOOST_TEST(!(x2 == x1)); - - x2.insert(1); - BOOST_TEST(x1 == x2); - BOOST_TEST(!(x1 != x2)); - - x2.insert(2); - BOOST_TEST(x1 != x2); - BOOST_TEST(!(x1 == x2)); - BOOST_TEST(x2 != x1); - BOOST_TEST(!(x2 == x1)); - } - - UNORDERED_AUTO_TEST(equality_key_value_tests) - { - UNORDERED_EQUALITY_MULTISET_TEST((1), !=, (2)) - UNORDERED_EQUALITY_SET_TEST((2), ==, (2)) - UNORDERED_EQUALITY_MAP_TEST(((1)(1))((2)(1)), !=, ((1)(1))((3)(1))) - } - - UNORDERED_AUTO_TEST(equality_collision_test) - { - UNORDERED_EQUALITY_MULTISET_TEST( - (1), !=, (501)) - UNORDERED_EQUALITY_MULTISET_TEST( - (1)(251), !=, (1)(501)) - UNORDERED_EQUALITY_MULTIMAP_TEST( - ((251)(1))((1)(1)), !=, ((501)(1))((1)(1))) - UNORDERED_EQUALITY_MULTISET_TEST( - (1)(501), ==, (1)(501)) - UNORDERED_EQUALITY_SET_TEST( - (1)(501), ==, (501)(1)) - } - - UNORDERED_AUTO_TEST(equality_group_size_test) - { - UNORDERED_EQUALITY_MULTISET_TEST( - (10)(20)(20), !=, (10)(10)(20)) - UNORDERED_EQUALITY_MULTIMAP_TEST( - ((10)(1))((20)(1))((20)(1)), !=, - ((10)(1))((20)(1))((10)(1))) - UNORDERED_EQUALITY_MULTIMAP_TEST( - ((20)(1))((10)(1))((10)(1)), ==, - ((10)(1))((20)(1))((10)(1))) - } - - UNORDERED_AUTO_TEST(equality_map_value_test) - { - UNORDERED_EQUALITY_MAP_TEST( - ((1)(1)), !=, ((1)(2))) - UNORDERED_EQUALITY_MAP_TEST( - ((1)(1)), ==, ((1)(1))) - UNORDERED_EQUALITY_MULTIMAP_TEST( - ((1)(1)), !=, ((1)(2))) - UNORDERED_EQUALITY_MULTIMAP_TEST( - ((1)(1))((1)(1)), !=, ((1)(1))((1)(2))) - UNORDERED_EQUALITY_MULTIMAP_TEST( - ((1)(2))((1)(1)), !=, ((1)(1))((1)(2))) - } - - UNORDERED_AUTO_TEST(equality_predicate_test) - { - UNORDERED_EQUALITY_SET_TEST( - (1), ==, (1001)) - UNORDERED_EQUALITY_MAP_TEST( - ((1)(2))((1001)(1)), ==, ((1001)(2))((1)(1))) - } - - // Test that equality still works when the two containers have - // different hash functions but the same equality predicate. - - UNORDERED_AUTO_TEST(equality_different_hash_test) - { - typedef boost::unordered_set set; - set set1(0, mod_compare(false), mod_compare(false)); - set set2(0, mod_compare(true), mod_compare(true)); - BOOST_TEST(set1 == set2); - set1.insert(1); set2.insert(2); - BOOST_TEST(set1 != set2); - set1.insert(2); set2.insert(1); - BOOST_TEST(set1 == set2); - set1.insert(10); set2.insert(20); - BOOST_TEST(set1 != set2); - set1.insert(20); set2.insert(10); - BOOST_TEST(set1 == set2); - } - -} - -RUN_TESTS() diff --git a/test/unordered/insert_tests.cpp b/test/unordered/insert_tests.cpp index 7208f54b..9fc75580 100644 --- a/test/unordered/insert_tests.cpp +++ b/test/unordered/insert_tests.cpp @@ -658,20 +658,6 @@ UNORDERED_AUTO_TEST(map_emplace_test) 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)); - - 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) @@ -705,6 +691,19 @@ UNORDERED_AUTO_TEST(set_emplace_test) BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); } +struct derived_from_piecewise_construct_t : + boost::unordered::piecewise_construct_t {}; + +derived_from_piecewise_construct_t piecewise_rvalue() { + return derived_from_piecewise_construct_t(); +} + +struct convertible_to_piecewise { + operator boost::unordered::piecewise_construct_t() const { + return boost::unordered::piecewise_construct; + } +}; + UNORDERED_AUTO_TEST(map_emplace_test2) { boost::unordered_map x; @@ -713,13 +712,18 @@ UNORDERED_AUTO_TEST(map_emplace_test2) BOOST_TEST(x.find(overloaded_constructor()) != x.end() && x.find(overloaded_constructor())->second == overloaded_constructor()); - x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(1), boost::make_tuple()); + x.emplace(convertible_to_piecewise(), boost::make_tuple(1), boost::make_tuple()); BOOST_TEST(x.find(overloaded_constructor(1)) != x.end() && x.find(overloaded_constructor(1))->second == overloaded_constructor()); - x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(2,3), boost::make_tuple(4,5,6)); + x.emplace(piecewise_rvalue(), boost::make_tuple(2,3), boost::make_tuple(4,5,6)); BOOST_TEST(x.find(overloaded_constructor(2,3)) != x.end() && x.find(overloaded_constructor(2,3))->second == overloaded_constructor(4,5,6)); + + derived_from_piecewise_construct_t d; + x.emplace(d, boost::make_tuple(9,3,1), boost::make_tuple(10)); + BOOST_TEST(x.find(overloaded_constructor(9,3,1)) != x.end() && + x.find(overloaded_constructor(9,3,1))->second == overloaded_constructor(10)); } UNORDERED_AUTO_TEST(set_emplace_test2) diff --git a/test/unordered/move_tests.cpp b/test/unordered/move_tests.cpp index 8866f826..8c7e8702 100644 --- a/test/unordered/move_tests.cpp +++ b/test/unordered/move_tests.cpp @@ -23,7 +23,7 @@ namespace move_tests { test::seed_t initialize_seed(98624); -#if defined(BOOST_UNORDERED_USE_MOVE) || !defined(BOOST_NO_RVALUE_REFERENCES) +#if defined(BOOST_UNORDERED_USE_MOVE) || !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #define BOOST_UNORDERED_TEST_MOVING 1 #else #define BOOST_UNORDERED_TEST_MOVING 0 @@ -154,7 +154,7 @@ namespace move_tests test::random_values v(25, generator); T y(create(v, count, hf, eq, al, 1.0), al); -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) BOOST_TEST(count == test::global_object_count); #elif defined(BOOST_HAS_NRVO) BOOST_TEST( diff --git a/test/unordered/unnecessary_copy_tests.cpp b/test/unordered/unnecessary_copy_tests.cpp index 143262aa..e33f999c 100644 --- a/test/unordered/unnecessary_copy_tests.cpp +++ b/test/unordered/unnecessary_copy_tests.cpp @@ -195,7 +195,7 @@ namespace unnecessary_copy_tests reset(); T x; x.emplace(source()); -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) COPY_COUNT(1); #else COPY_COUNT(2); @@ -215,7 +215,7 @@ namespace unnecessary_copy_tests BOOST_DEDUCED_TYPENAME T::value_type a; COPY_COUNT(1); MOVE_COUNT(0); x.emplace(boost::move(a)); -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) COPY_COUNT(1); MOVE_COUNT(1); #else // Since std::pair isn't movable, move only works for sets. @@ -249,7 +249,7 @@ namespace unnecessary_copy_tests BOOST_DEDUCED_TYPENAME T::value_type a; COPY_COUNT(1); MOVE_COUNT(0); x.emplace(boost::move(a)); -#if defined(BOOST_NO_RVALUE_REFERENCES) +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) COPY_COUNT(2); MOVE_COUNT(0); #else COPY_COUNT(1); MOVE_COUNT(1); @@ -285,8 +285,8 @@ namespace unnecessary_copy_tests // the existing element. reset(); x.emplace(); -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || \ - !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \ + !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) // source_cost doesn't make much sense here, but it seems to fit. COPY_COUNT(1); MOVE_COUNT(source_cost); #else @@ -313,7 +313,7 @@ namespace unnecessary_copy_tests // No move should take place. reset(); x.emplace(boost::move(a)); -#if !defined(BOOST_NO_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) COPY_COUNT(0); MOVE_COUNT(0); #else COPY_COUNT(0); MOVE_COUNT(1);