Unordered: Remove and update various deprecated things.

[SVN r81727]
This commit is contained in:
Daniel James
2012-12-05 22:06:57 +00:00
parent 981f1e2acb
commit 654fed166a
22 changed files with 147 additions and 532 deletions

View File

@ -220,4 +220,12 @@ C++11 support has resulted in some breaking changes:
for C++11 allocators. for C++11 allocators.
* Simplified the implementation a bit. Hopefully more robust. * 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] [endsect]

View File

@ -449,10 +449,6 @@ EOL;
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="emplace_hint"> <method name="emplace_hint">
@ -499,10 +495,6 @@ EOL;
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="insert"> <method name="insert">
@ -1114,9 +1106,7 @@ EOL;
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>
@ -1157,9 +1147,7 @@ EOL;
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>

View File

@ -383,10 +383,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="emplace_hint"> <method name="emplace_hint">
@ -426,10 +422,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="insert"> <method name="insert">
@ -970,9 +962,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>
@ -1005,9 +995,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>
@ -1429,10 +1417,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="emplace_hint"> <method name="emplace_hint">
@ -1472,10 +1456,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="insert"> <method name="insert">
@ -2014,9 +1994,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>
@ -2049,9 +2027,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>
@ -2488,10 +2464,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="emplace_hint"> <method name="emplace_hint">
@ -2531,10 +2503,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="insert"> <method name="insert">
@ -3108,9 +3076,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>
@ -3145,9 +3111,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>
@ -3581,10 +3545,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="emplace_hint"> <method name="emplace_hint">
@ -3624,10 +3584,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>Since existing <code>std::pair</code> implementations don't support <para>Since existing <code>std::pair</code> implementations don't support
<code>std::piecewise_construct</code> this emulates it, <code>std::piecewise_construct</code> this emulates it,
but using <code>boost::unordered::piecewise_construct</code>.</para> but using <code>boost::unordered::piecewise_construct</code>.</para>
<para>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
<code>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT</code>.</para>
</notes> </notes>
</method> </method>
<method name="insert"> <method name="insert">
@ -4168,9 +4124,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>
@ -4205,9 +4159,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description> </description>
<notes> <notes>
<para>The behavior of this function was changed to match <para>The behavior of this function was changed to match
the C++11 standard in Boost 1.48. If you wish to use the C++11 standard in Boost 1.48.</para>
the old behaviour, define the macro
<code>BOOST_UNORDERED_DEPRECATED_EQUALITY</code>.</para>
<para>Behavior is undefined if the two containers don't have <para>Behavior is undefined if the two containers don't have
equivalent equality predicates.</para> equivalent equality predicates.</para>
</notes> </notes>

View File

@ -85,7 +85,7 @@ namespace boost { namespace unordered { namespace detail {
// Either forwarding variadic arguments, or storing the arguments in // Either forwarding variadic arguments, or storing the arguments in
// emplace_args##n // 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_TEMPLATE typename... Args
#define BOOST_UNORDERED_EMPLACE_ARGS BOOST_FWD_REF(Args)... 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_ARGS2 create_emplace_args
#define BOOST_UNORDERED_EMPLACE_ARGS3 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, _) \ #define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \
typedef BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(Arg, 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 <boost/type_traits/is_same.hpp> # include <boost/type_traits/is_same.hpp>
# endif # endif
# if !defined(BOOST_NO_VARIADIC_TEMPLATES) && \ # if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
!defined(BOOST_NO_SFINAE_EXPR) !defined(BOOST_NO_SFINAE_EXPR)
# define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 1 # define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 1
# else # else
@ -432,7 +432,7 @@ namespace boost { namespace unordered { namespace detail {
max_size, U const, (), 0 max_size, U const, (), 0
); );
# if !defined(BOOST_NO_VARIADIC_TEMPLATES) # if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename T, typename ValueType, typename... Args> template <typename T, typename ValueType, typename... Args>
BOOST_UNORDERED_HAS_FUNCTION( BOOST_UNORDERED_HAS_FUNCTION(
@ -763,7 +763,7 @@ namespace boost { namespace unordered { namespace detail {
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// call_construct // call_construct
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
# if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT # if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT
@ -812,7 +812,7 @@ namespace boost { namespace unordered { namespace detail {
// //
// Used for piecewise construction. // 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_) \ # define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \
template<typename Alloc, typename T> \ template<typename Alloc, typename T> \
@ -921,62 +921,26 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::)
#endif #endif
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// SFINAE traits for construction. // Trait to check for piecewise construction.
// Decide which construction method to use for a three argument template <typename A0>
// call. Note that this is difficult to do using overloads because struct use_piecewise {
// the arguments are packed into 'emplace_args3'.
//
// The decision is made on the first argument.
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
template <typename A, typename B, typename A0>
struct emulation1 {
static choice1::type test(choice1, std::pair<A, B> 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<A0>())) ==
sizeof(choice2::type) };
};
#endif
template <typename A, typename B, typename A0>
struct check3_base {
static choice1::type test(choice1, static choice1::type test(choice1,
boost::unordered::piecewise_construct_t); boost::unordered::piecewise_construct_t);
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) static choice2::type test(choice2, ...);
static choice2::type test(choice2, A const&);
#endif
static choice3::type test(choice3, ...); enum { value = sizeof(choice1::type) ==
enum { value =
sizeof(test(choose(), boost::unordered::detail::make<A0>())) }; sizeof(test(choose(), boost::unordered::detail::make<A0>())) };
}; };
template <typename A, typename B, typename A0> #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
struct piecewise3 {
enum { value = check3_base<A,B,A0>::value == sizeof(choice1::type) };
};
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT)
template <typename A, typename B, typename A0>
struct emulation3 {
enum { value = check3_base<A,B,A0>::value == sizeof(choice2::type) };
};
#endif
// TODO: Full construct?
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Construct from variadic parameters // Construct from variadic parameters
// For the standard pair constructor.
template <typename Alloc, typename T, typename... Args> template <typename Alloc, typename T, typename... Args>
inline void construct_value_impl(Alloc& alloc, T* address, inline void construct_value_impl(Alloc& alloc, T* address,
BOOST_FWD_REF(Args)... args) BOOST_FWD_REF(Args)... args)
@ -985,9 +949,14 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::)
address, boost::forward<Args>(args)...); address, boost::forward<Args>(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 <typename Alloc, typename A, typename B, template <typename Alloc, typename A, typename B,
typename A0, typename A1, typename A2> typename A0, typename A1, typename A2>
inline typename enable_if<piecewise3<A, B, A0>, void>::type inline typename enable_if<use_piecewise<A0>, void>::type
construct_value_impl(Alloc& alloc, std::pair<A, B>* address, construct_value_impl(Alloc& alloc, std::pair<A, B>* address,
BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) 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>(a2)); boost::addressof(address->second), boost::forward<A2>(a2));
} }
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) #else // BOOST_NO_CXX11_VARIADIC_TEMPLATES
template <typename Alloc, typename A, typename B, typename A0>
inline typename enable_if<emulation1<A, B, A0>, void>::type
construct_value_impl(Alloc& alloc, std::pair<A, B>* address,
BOOST_FWD_REF(A0) a0)
{
boost::unordered::detail::call_construct(alloc,
boost::addressof(address->first),boost::forward<A0>(a0));
boost::unordered::detail::call_construct(alloc,
boost::addressof(address->second));
}
template <typename Alloc, typename A, typename B,
typename A0, typename A1, typename A2>
inline typename enable_if<emulation3<A, B, A0>, void>::type
construct_value_impl(Alloc& alloc, std::pair<A, B>* 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>(a0));
boost::unordered::detail::call_construct(alloc,
boost::addressof(address->second),
boost::forward<A1>(a1),
boost::forward<A2>(a2));
}
template <typename Alloc, typename A, typename B,
typename A0, typename A1, typename A2, typename A3,
typename... Args>
inline void construct_value_impl(Alloc& alloc, std::pair<A, B>* 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>(a0));
boost::unordered::detail::call_construct(alloc,
boost::addressof(address->second),
boost::forward<A1>(a1),
boost::forward<A2>(a2),
boost::forward<A3>(a3),
boost::forward<Args>(args)...);
}
#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
#else // BOOST_NO_VARIADIC_TEMPLATES
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Construct from emplace_args // Construct from emplace_args
#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \ // Explicitly write out first three overloads for the sake of sane
template < \ // error messages.
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)); \
}
template <typename Alloc, typename T, typename A0> template <typename Alloc, typename T, typename A0>
inline void construct_value_impl(Alloc&, T* address, 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_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
BOOST_UNORDERED_CONSTRUCT_IMPL, _) BOOST_UNORDERED_CONSTRUCT_IMPL, _)
#undef BOOST_UNORDERED_CONSTRUCT_IMPL #undef BOOST_UNORDERED_CONSTRUCT_IMPL
// Construct with piece_construct
template <typename Alloc, typename A, typename B, template <typename Alloc, typename A, typename B,
typename A0, typename A1, typename A2> typename A0, typename A1, typename A2>
inline void construct_value_impl(Alloc& alloc, std::pair<A, B>* address, inline void construct_value_impl(Alloc& alloc, std::pair<A, B>* address,
boost::unordered::detail::emplace_args3<A0, A1, A2> const& args, boost::unordered::detail::emplace_args3<A0, A1, A2> const& args,
typename enable_if<piecewise3<A, B, A0>, void*>::type = 0) typename enable_if<use_piecewise<A0>, void*>::type = 0)
{ {
boost::unordered::detail::construct_from_tuple(alloc, boost::unordered::detail::construct_from_tuple(alloc,
boost::addressof(address->first), args.a1); boost::addressof(address->first), args.a1);
@ -1107,59 +1038,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::)
boost::addressof(address->second), args.a2); boost::addressof(address->second), args.a2);
} }
#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) #endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
template <typename Alloc, typename A, typename B, typename A0>
inline void construct_value_impl(Alloc&, std::pair<A, B>* address,
boost::unordered::detail::emplace_args1<A0> const& args,
typename enable_if<emulation1<A, B, A0>, void*>::type = 0)
{
new((void*) boost::addressof(address->first)) A(
boost::forward<A0>(args.a0));
new((void*) boost::addressof(address->second)) B();
}
template <typename Alloc, typename A, typename B,
typename A0, typename A1, typename A2>
inline void construct_value_impl(Alloc&, std::pair<A, B>* address,
boost::unordered::detail::emplace_args3<A0, A1, A2> const& args,
typename enable_if<emulation3<A, B, A0>, void*>::type = 0)
{
new((void*) boost::addressof(address->first)) A(
boost::forward<A0>(args.a0));
new((void*) boost::addressof(address->second)) B(
boost::forward<A1>(args.a1),
boost::forward<A2>(args.a2));
}
#define BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL(z, num_params, _) \
template <typename Alloc, typename A, typename B, \
BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A) \
> \
inline void construct_value_impl(Alloc&, std::pair<A, B>* 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<A0>(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
}}} }}}

View File

@ -777,7 +777,7 @@ namespace boost { namespace unordered { namespace detail {
// rvalue parameters when type can't be a BOOST_RV_REF(T) parameter // rvalue parameters when type can't be a BOOST_RV_REF(T) parameter
// e.g. for int // 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) # define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T)
#else #else
struct please_ignore_this_overload { struct please_ignore_this_overload {

View File

@ -302,8 +302,6 @@ namespace boost { namespace unordered { namespace detail {
return true; return true;
} }
#if !defined(BOOST_UNORDERED_DEPRECATED_EQUALITY)
static bool group_equals(iterator n1, iterator end1, static bool group_equals(iterator n1, iterator end1,
iterator n2, iterator end2) iterator n2, iterator end2)
{ {
@ -364,26 +362,6 @@ namespace boost { namespace unordered { namespace detail {
return count; 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 // Emplace/Insert
static inline void add_after_node( 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)); this->add_node(a, key_hash, this->find_node(key_hash, k));
} }
#if defined(BOOST_NO_RVALUE_REFERENCES) #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
# if defined(BOOST_NO_VARIADIC_TEMPLATES) # if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
iterator emplace(boost::unordered::detail::emplace_args1< iterator emplace(boost::unordered::detail::emplace_args1<
boost::unordered::detail::please_ignore_this_overload> const&) boost::unordered::detail::please_ignore_this_overload> const&)
{ {

View File

@ -56,7 +56,7 @@ namespace detail {
return no_key(); return no_key();
} }
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <class... Args> template <class... Args>
static no_key extract(Args const&...) static no_key extract(Args const&...)
{ {
@ -75,11 +75,6 @@ namespace detail {
return no_key(); return no_key();
} }
#endif #endif
static bool compare_mapped(value_type const&, value_type const&)
{
return true;
}
}; };
template <class Key, class ValueType> template <class Key, class ValueType>
@ -93,11 +88,6 @@ namespace detail {
return v.first; return v.first;
} }
static key_type const& extract(key_type const& v)
{
return v;
}
template <class Second> template <class Second>
static key_type const& extract(std::pair<key_type, Second> const& v) static key_type const& extract(std::pair<key_type, Second> const& v)
{ {
@ -111,14 +101,13 @@ namespace detail {
return v.first; return v.first;
} }
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) template <class Arg1>
template <class Arg1, class... Args> static key_type const& extract(key_type const& k, Arg1 const&)
static key_type const& extract(key_type const& k,
Arg1 const&, Args const&...)
{ {
return k; return k;
} }
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <class... Args> template <class... Args>
static no_key extract(Args const&...) static no_key extract(Args const&...)
{ {
@ -126,12 +115,6 @@ namespace detail {
} }
#else #else
template <class Arg1>
static key_type const& extract(key_type const& k, Arg1 const&)
{
return k;
}
static no_key extract() static no_key extract()
{ {
return no_key(); return no_key();
@ -150,12 +133,12 @@ namespace detail {
} }
#endif #endif
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \ #define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \
template <typename T2> \ template <typename T2> \
static no_key extract(boost::unordered::piecewise_construct_t, \ static no_key extract(boost::unordered::piecewise_construct_t, \
namespace_ tuple<> const&, BOOST_FWD_REF(T2)) \ namespace_ tuple<> const&, T2 const&) \
{ \ { \
return no_key(); \ return no_key(); \
} \ } \
@ -163,7 +146,7 @@ namespace detail {
template <typename T, typename T2> \ template <typename T, typename T2> \
static typename is_key<key_type, T>::type \ static typename is_key<key_type, T>::type \
extract(boost::unordered::piecewise_construct_t, \ extract(boost::unordered::piecewise_construct_t, \
namespace_ tuple<T> const& k, BOOST_FWD_REF(T2)) \ namespace_ tuple<T> const& k, T2 const&) \
{ \ { \
return typename is_key<key_type, T>::type( \ return typename is_key<key_type, T>::type( \
namespace_ get<0>(k)); \ namespace_ get<0>(k)); \
@ -194,12 +177,6 @@ BOOST_UNORDERED_KEY_FROM_TUPLE(boost::)
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) #if !defined(BOOST_NO_CXX11_HDR_TUPLE)
BOOST_UNORDERED_KEY_FROM_TUPLE(std::) BOOST_UNORDERED_KEY_FROM_TUPLE(std::)
#endif #endif
static bool compare_mapped(value_type const& x, value_type const& y)
{
return x.second == y.second;
}
}; };
}}} }}}

View File

@ -18,6 +18,18 @@
#pragma warning(disable:4127) // conditional expression is constant #pragma warning(disable:4127) // conditional expression is constant
#endif #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 { namespace boost { namespace unordered { namespace detail {
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////

View File

@ -290,13 +290,8 @@ namespace boost { namespace unordered { namespace detail {
{ {
iterator n2 = other.find_matching_node(n1); iterator n2 = other.find_matching_node(n1);
#if !defined(BOOST_UNORDERED_DEPRECATED_EQUALITY)
if (!n2.node_ || *n1 != *n2) if (!n2.node_ || *n1 != *n2)
return false; return false;
#else
if (!n2.node_ || !extractor::compare_mapped(*n1, *n2))
return false;
#endif
} }
return true; return true;
@ -358,8 +353,8 @@ namespace boost { namespace unordered { namespace detail {
return *add_node(a, key_hash); return *add_node(a, key_hash);
} }
#if defined(BOOST_NO_RVALUE_REFERENCES) #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
# if defined(BOOST_NO_VARIADIC_TEMPLATES) # if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
emplace_return emplace(boost::unordered::detail::emplace_args1< emplace_return emplace(boost::unordered::detail::emplace_args1<
boost::unordered::detail::please_ignore_this_overload> const&) boost::unordered::detail::please_ignore_this_overload> const&)
{ {
@ -379,7 +374,7 @@ namespace boost { namespace unordered { namespace detail {
template <BOOST_UNORDERED_EMPLACE_TEMPLATE> template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
emplace_return emplace(BOOST_UNORDERED_EMPLACE_ARGS) emplace_return emplace(BOOST_UNORDERED_EMPLACE_ARGS)
{ {
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
return emplace_impl( return emplace_impl(
extractor::extract(BOOST_UNORDERED_EMPLACE_FORWARD), extractor::extract(BOOST_UNORDERED_EMPLACE_FORWARD),
BOOST_UNORDERED_EMPLACE_FORWARD); BOOST_UNORDERED_EMPLACE_FORWARD);
@ -390,7 +385,7 @@ namespace boost { namespace unordered { namespace detail {
#endif #endif
} }
#if defined(BOOST_NO_VARIADIC_TEMPLATES) #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename A0> template <typename A0>
emplace_return emplace( emplace_return emplace(
boost::unordered::detail::emplace_args1<A0> const& args) boost::unordered::detail::emplace_args1<A0> const& args)

View File

@ -120,14 +120,14 @@ namespace unordered
: table_(other.table_, boost::unordered::detail::move_tag()) : 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) unordered_map(unordered_map&& other)
: table_(other.table_, boost::unordered::detail::move_tag()) : table_(other.table_, boost::unordered::detail::move_tag())
{ {
} }
#endif #endif
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_map(unordered_map&&, allocator_type const&); unordered_map(unordered_map&&, allocator_type const&);
#endif #endif
@ -165,7 +165,7 @@ namespace unordered
return *this; return *this;
} }
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_map& operator=(unordered_map&& x) unordered_map& operator=(unordered_map&& x)
{ {
table_.move_assign(x.table_); table_.move_assign(x.table_);
@ -231,7 +231,7 @@ namespace unordered
// emplace // emplace
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <class... Args> template <class... Args>
std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args) std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
{ {
@ -601,14 +601,14 @@ namespace unordered
: table_(other.table_, boost::unordered::detail::move_tag()) : 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) unordered_multimap(unordered_multimap&& other)
: table_(other.table_, boost::unordered::detail::move_tag()) : table_(other.table_, boost::unordered::detail::move_tag())
{ {
} }
#endif #endif
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multimap(unordered_multimap&&, allocator_type const&); unordered_multimap(unordered_multimap&&, allocator_type const&);
#endif #endif
@ -647,7 +647,7 @@ namespace unordered
return *this; return *this;
} }
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multimap& operator=(unordered_multimap&& x) unordered_multimap& operator=(unordered_multimap&& x)
{ {
table_.move_assign(x.table_); table_.move_assign(x.table_);
@ -713,7 +713,7 @@ namespace unordered
// emplace // emplace
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <class... Args> template <class... Args>
iterator emplace(BOOST_FWD_REF(Args)... args) 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 <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
unordered_map<K,T,H,P,A>::unordered_map( unordered_map<K,T,H,P,A>::unordered_map(
@ -1399,7 +1399,7 @@ namespace unordered
{ {
} }
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class K, class T, class H, class P, class A> template <class K, class T, class H, class P, class A>
unordered_multimap<K,T,H,P,A>::unordered_multimap( unordered_multimap<K,T,H,P,A>::unordered_multimap(

View File

@ -118,14 +118,14 @@ namespace unordered
: table_(other.table_, boost::unordered::detail::move_tag()) : 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) unordered_set(unordered_set&& other)
: table_(other.table_, boost::unordered::detail::move_tag()) : table_(other.table_, boost::unordered::detail::move_tag())
{ {
} }
#endif #endif
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_set(unordered_set&&, allocator_type const&); unordered_set(unordered_set&&, allocator_type const&);
#endif #endif
@ -163,7 +163,7 @@ namespace unordered
return *this; return *this;
} }
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_set& operator=(unordered_set&& x) unordered_set& operator=(unordered_set&& x)
{ {
table_.move_assign(x.table_); table_.move_assign(x.table_);
@ -229,7 +229,7 @@ namespace unordered
// emplace // emplace
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <class... Args> template <class... Args>
std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args) std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
{ {
@ -585,14 +585,14 @@ namespace unordered
: table_(other.table_, boost::unordered::detail::move_tag()) : 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) unordered_multiset(unordered_multiset&& other)
: table_(other.table_, boost::unordered::detail::move_tag()) : table_(other.table_, boost::unordered::detail::move_tag())
{ {
} }
#endif #endif
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multiset(unordered_multiset&&, allocator_type const&); unordered_multiset(unordered_multiset&&, allocator_type const&);
#endif #endif
@ -631,7 +631,7 @@ namespace unordered
return *this; return *this;
} }
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multiset& operator=(unordered_multiset&& x) unordered_multiset& operator=(unordered_multiset&& x)
{ {
table_.move_assign(x.table_); table_.move_assign(x.table_);
@ -697,7 +697,7 @@ namespace unordered
// emplace // emplace
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <class... Args> template <class... Args>
iterator emplace(BOOST_FWD_REF(Args)... args) 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 <class T, class H, class P, class A> template <class T, class H, class P, class A>
unordered_set<T,H,P,A>::unordered_set( unordered_set<T,H,P,A>::unordered_set(
@ -1325,7 +1325,7 @@ namespace unordered
{ {
} }
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class T, class H, class P, class A> template <class T, class H, class P, class A>
unordered_multiset<T,H,P,A>::unordered_multiset( unordered_multiset<T,H,P,A>::unordered_multiset(

View File

@ -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 <class T> template <class T>
struct emplace_test1 : public insert_test_base<T> struct emplace_test1 : public insert_test_base<T>
@ -236,7 +236,7 @@ struct insert_test_rehash3 : public insert_test_base<T>
(insert_test1)(insert_test2)(insert_test3)(insert_test4) \ (insert_test1)(insert_test2)(insert_test3)(insert_test4) \
(insert_test_rehash1)(insert_test_rehash2)(insert_test_rehash3) (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 #define ALL_TESTS (emplace_test1)BASIC_TESTS
#else #else
#define ALL_TESTS BASIC_TESTS #define ALL_TESTS BASIC_TESTS

View File

@ -170,7 +170,7 @@ namespace test
new(p) T(t); new(p) T(t);
} }
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<typename... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) { template<typename... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
detail::tracker.track_construct((void*) p, sizeof(T), tag_); detail::tracker.track_construct((void*) p, sizeof(T), tag_);
new(p) T(boost::forward<Args>(args)...); new(p) T(boost::forward<Args>(args)...);

View File

@ -348,7 +348,7 @@ namespace exception
test::detail::tracker.track_construct((void*) p, sizeof(T), tag_); test::detail::tracker.track_construct((void*) p, sizeof(T), tag_);
} }
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) { template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
UNORDERED_SCOPE(allocator::construct(pointer, BOOST_FWD_REF(Args)...)) { UNORDERED_SCOPE(allocator::construct(pointer, BOOST_FWD_REF(Args)...)) {
UNORDERED_EPOINT("Mock allocator construct function."); UNORDERED_EPOINT("Mock allocator construct function.");
@ -528,7 +528,7 @@ namespace exception
test::detail::tracker.track_construct((void*) p, sizeof(T), tag_); test::detail::tracker.track_construct((void*) p, sizeof(T), tag_);
} }
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) { template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
UNORDERED_SCOPE(allocator2::construct(pointer, BOOST_FWD_REF(Args)...)) { UNORDERED_SCOPE(allocator2::construct(pointer, BOOST_FWD_REF(Args)...)) {
UNORDERED_EPOINT("Mock allocator2 construct function."); UNORDERED_EPOINT("Mock allocator2 construct function.");

View File

@ -155,7 +155,7 @@ namespace minimal
~movable1() {} ~movable1() {}
}; };
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
class movable2 class movable2
{ {
public: public:
@ -371,7 +371,7 @@ namespace minimal
void construct(T* p, T const& t) { new((void*)p) T(t); } 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<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) { template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
new((void*)p) T(boost::forward<Args>(args)...); new((void*)p) T(boost::forward<Args>(args)...);
} }
@ -443,7 +443,7 @@ namespace minimal
void construct(T* p, T const& t) { new((void*)p) T(t); } 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<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) { template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
new((void*)p) T(boost::forward<Args>(args)...); new((void*)p) T(boost::forward<Args>(args)...);
} }

View File

@ -591,7 +591,7 @@ namespace test
new(p) T(t); new(p) T(t);
} }
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) { template<class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args) {
detail::tracker.track_construct((void*) p, sizeof(T), tag_); detail::tracker.track_construct((void*) p, sizeof(T), tag_);
new(p) T(boost::forward<Args>(args)...); new(p) T(boost::forward<Args>(args)...);

View File

@ -34,9 +34,6 @@ test-suite unordered
[ run move_tests.cpp ] [ run move_tests.cpp ]
[ run assign_tests.cpp ] [ run assign_tests.cpp ]
[ run insert_tests.cpp ] [ run insert_tests.cpp ]
[ run insert_tests.cpp : :
: <define>BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
: insert_deprecated ]
[ run insert_stable_tests.cpp ] [ run insert_stable_tests.cpp ]
[ run unnecessary_copy_tests.cpp ] [ run unnecessary_copy_tests.cpp ]
[ run erase_tests.cpp ] [ run erase_tests.cpp ]
@ -47,7 +44,6 @@ test-suite unordered
[ run load_factor_tests.cpp ] [ run load_factor_tests.cpp ]
[ run rehash_tests.cpp ] [ run rehash_tests.cpp ]
[ run equality_tests.cpp ] [ run equality_tests.cpp ]
[ run equality_deprecated.cpp ]
[ run swap_tests.cpp ] [ run swap_tests.cpp ]
[ run compile_set.cpp : : [ run compile_set.cpp : :

View File

@ -137,7 +137,7 @@ void unordered_destructible_test(X&)
X x1; X x1;
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
X x2(rvalue_default<X>()); X x2(rvalue_default<X>());
X x3 = rvalue_default<X>(); X x3 = rvalue_default<X>();
// This can only be done if propagate_on_container_move_assignment::value // 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::iterator iterator;
typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_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>()); X x1(rvalue_default<X>());
X x2(boost::move(x1)); X x2(boost::move(x1));
x1 = rvalue_default<X>(); x1 = rvalue_default<X>();

View File

@ -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 <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
#include "../helpers/postfix.hpp"
#include <boost/preprocessor/seq.hpp>
#include <list>
#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<int, mod_compare, mod_compare> 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<int, mod_compare, mod_compare> \
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<int, int, mod_compare, mod_compare> \
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<int, int, mod_compare, mod_compare> \
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<int const, int> BOOST_PP_SEQ_TO_TUPLE(item));
UNORDERED_AUTO_TEST(equality_size_tests)
{
boost::unordered_set<int> 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<int, mod_compare, mod_compare> 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()

View File

@ -658,20 +658,6 @@ UNORDERED_AUTO_TEST(map_emplace_test)
x.emplace(2, 3); x.emplace(2, 3);
BOOST_TEST(x.find(2) != x.end() && BOOST_TEST(x.find(2) != x.end() &&
x.find(2)->second == overloaded_constructor(3)); 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) 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); 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) UNORDERED_AUTO_TEST(map_emplace_test2)
{ {
boost::unordered_map<overloaded_constructor, overloaded_constructor> x; boost::unordered_map<overloaded_constructor, overloaded_constructor> x;
@ -713,13 +712,18 @@ UNORDERED_AUTO_TEST(map_emplace_test2)
BOOST_TEST(x.find(overloaded_constructor()) != x.end() && BOOST_TEST(x.find(overloaded_constructor()) != x.end() &&
x.find(overloaded_constructor())->second == overloaded_constructor()); 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() && BOOST_TEST(x.find(overloaded_constructor(1)) != x.end() &&
x.find(overloaded_constructor(1))->second == overloaded_constructor()); 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() && BOOST_TEST(x.find(overloaded_constructor(2,3)) != x.end() &&
x.find(overloaded_constructor(2,3))->second == overloaded_constructor(4,5,6)); 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) UNORDERED_AUTO_TEST(set_emplace_test2)

View File

@ -23,7 +23,7 @@
namespace move_tests namespace move_tests
{ {
test::seed_t initialize_seed(98624); 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 #define BOOST_UNORDERED_TEST_MOVING 1
#else #else
#define BOOST_UNORDERED_TEST_MOVING 0 #define BOOST_UNORDERED_TEST_MOVING 0
@ -154,7 +154,7 @@ namespace move_tests
test::random_values<T> v(25, generator); test::random_values<T> v(25, generator);
T y(create(v, count, hf, eq, al, 1.0), al); 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); BOOST_TEST(count == test::global_object_count);
#elif defined(BOOST_HAS_NRVO) #elif defined(BOOST_HAS_NRVO)
BOOST_TEST( BOOST_TEST(

View File

@ -195,7 +195,7 @@ namespace unnecessary_copy_tests
reset(); reset();
T x; T x;
x.emplace(source<BOOST_DEDUCED_TYPENAME T::value_type>()); x.emplace(source<BOOST_DEDUCED_TYPENAME T::value_type>());
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(1); COPY_COUNT(1);
#else #else
COPY_COUNT(2); COPY_COUNT(2);
@ -215,7 +215,7 @@ namespace unnecessary_copy_tests
BOOST_DEDUCED_TYPENAME T::value_type a; BOOST_DEDUCED_TYPENAME T::value_type a;
COPY_COUNT(1); MOVE_COUNT(0); COPY_COUNT(1); MOVE_COUNT(0);
x.emplace(boost::move(a)); x.emplace(boost::move(a));
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(1); MOVE_COUNT(1); COPY_COUNT(1); MOVE_COUNT(1);
#else #else
// Since std::pair isn't movable, move only works for sets. // 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; BOOST_DEDUCED_TYPENAME T::value_type a;
COPY_COUNT(1); MOVE_COUNT(0); COPY_COUNT(1); MOVE_COUNT(0);
x.emplace(boost::move(a)); x.emplace(boost::move(a));
#if defined(BOOST_NO_RVALUE_REFERENCES) #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(2); MOVE_COUNT(0); COPY_COUNT(2); MOVE_COUNT(0);
#else #else
COPY_COUNT(1); MOVE_COUNT(1); COPY_COUNT(1); MOVE_COUNT(1);
@ -285,8 +285,8 @@ namespace unnecessary_copy_tests
// the existing element. // the existing element.
reset(); reset();
x.emplace(); x.emplace();
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || \ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \
!defined(BOOST_NO_RVALUE_REFERENCES) !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
// source_cost doesn't make much sense here, but it seems to fit. // source_cost doesn't make much sense here, but it seems to fit.
COPY_COUNT(1); MOVE_COUNT(source_cost); COPY_COUNT(1); MOVE_COUNT(source_cost);
#else #else
@ -313,7 +313,7 @@ namespace unnecessary_copy_tests
// No move should take place. // No move should take place.
reset(); reset();
x.emplace(boost::move(a)); x.emplace(boost::move(a));
#if !defined(BOOST_NO_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(0); MOVE_COUNT(0); COPY_COUNT(0); MOVE_COUNT(0);
#else #else
COPY_COUNT(0); MOVE_COUNT(1); COPY_COUNT(0); MOVE_COUNT(1);