mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 19:07:15 +02:00
Change clang format indentation + .editorconfig file
This commit is contained in:
7
.editorconfig
Normal file
7
.editorconfig
Normal file
@ -0,0 +1,7 @@
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
|
||||
[*.?pp]
|
||||
indent_size = 2
|
@ -11,8 +11,9 @@ BasedOnStyle: LLVM
|
||||
|
||||
# Basic settings
|
||||
ColumnLimit: 80
|
||||
ContinuationIndentWidth: 4
|
||||
IndentWidth: 4
|
||||
NamespaceIndentation: All
|
||||
ContinuationIndentWidth: 2
|
||||
IndentWidth: 2
|
||||
UseTab: Never
|
||||
Language: Cpp
|
||||
Standard: Cpp03
|
||||
|
@ -235,7 +235,9 @@ struct no_key
|
||||
};
|
||||
|
||||
namespace func {
|
||||
template <class T> inline void ignore_unused_variable_warning(T const&) {}
|
||||
template <class T> inline void ignore_unused_variable_warning(T const&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@ -333,21 +335,24 @@ inline std::size_t prev_prime(std::size_t num)
|
||||
|
||||
template <class I>
|
||||
inline std::size_t insert_size(I i, I j,
|
||||
typename boost::unordered::detail::enable_if_forward<I, void*>::type = 0)
|
||||
typename boost::unordered::detail::enable_if_forward<I, void*>::type =
|
||||
0)
|
||||
{
|
||||
return static_cast<std::size_t>(std::distance(i, j));
|
||||
}
|
||||
|
||||
template <class I>
|
||||
inline std::size_t insert_size(I, I,
|
||||
typename boost::unordered::detail::disable_if_forward<I, void*>::type = 0)
|
||||
typename boost::unordered::detail::disable_if_forward<I, void*>::type =
|
||||
0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
template <class I>
|
||||
inline std::size_t initial_size(I i, I j,
|
||||
std::size_t num_buckets = boost::unordered::detail::default_bucket_count)
|
||||
inline std::size_t initial_size(
|
||||
I i, I j, std::size_t num_buckets =
|
||||
boost::unordered::detail::default_bucket_count)
|
||||
{
|
||||
// TODO: Why +1?
|
||||
return (std::max)(
|
||||
@ -379,7 +384,8 @@ template <typename T, int Index> struct uncompressed_base
|
||||
|
||||
template <typename T, int Index>
|
||||
struct generate_base
|
||||
: boost::detail::if_true<boost::is_empty<T>::value>::BOOST_NESTED_TEMPLATE
|
||||
: boost::detail::if_true<
|
||||
boost::is_empty<T>::value>::BOOST_NESTED_TEMPLATE
|
||||
then<boost::unordered::detail::compressed_base<T, Index>,
|
||||
boost::unordered::detail::uncompressed_base<T, Index> >
|
||||
{
|
||||
@ -474,7 +480,8 @@ template <typename T1, typename T2> struct pair_traits<std::pair<T1, T2> >
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Bits and pieces for implementing traits
|
||||
|
||||
template <typename T> typename boost::add_lvalue_reference<T>::type make();
|
||||
template <typename T>
|
||||
typename boost::add_lvalue_reference<T>::type make();
|
||||
struct choice9
|
||||
{
|
||||
typedef char (&type)[9];
|
||||
@ -538,7 +545,10 @@ template <typename T> struct pointer
|
||||
return static_cast<T*>(x.operator->());
|
||||
}
|
||||
|
||||
template <typename T2> static T* get(T2* x) { return static_cast<T*>(x); }
|
||||
template <typename T2> static T* get(T2* x)
|
||||
{
|
||||
return static_cast<T*>(x);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@ -574,8 +584,7 @@ template <typename T> struct pointer
|
||||
|
||||
#endif
|
||||
|
||||
template <typename A0>
|
||||
struct emplace_args1
|
||||
template <typename A0> struct emplace_args1
|
||||
{
|
||||
BOOST_UNORDERED_EARGS_MEMBER(1, 0, _)
|
||||
|
||||
@ -644,8 +653,7 @@ inline emplace_args3<A0, A1, A2> create_emplace_args(
|
||||
\
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
inline BOOST_PP_CAT(emplace_args, n)<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> \
|
||||
create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, b)) \
|
||||
create_emplace_args(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, b)) \
|
||||
{ \
|
||||
BOOST_PP_CAT(emplace_args, n)<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> e( \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, b)); \
|
||||
@ -658,8 +666,8 @@ BOOST_UNORDERED_EARGS(1, 6, _)
|
||||
BOOST_UNORDERED_EARGS(1, 7, _)
|
||||
BOOST_UNORDERED_EARGS(1, 8, _)
|
||||
BOOST_UNORDERED_EARGS(1, 9, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(
|
||||
10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), BOOST_UNORDERED_EARGS, _)
|
||||
BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT),
|
||||
BOOST_UNORDERED_EARGS, _)
|
||||
|
||||
#undef BOOST_UNORDERED_DEFINE_EMPLACE_ARGS
|
||||
#undef BOOST_UNORDERED_EARGS_MEMBER
|
||||
@ -694,7 +702,8 @@ template <typename T, T Value> struct integral_constant
|
||||
};
|
||||
|
||||
typedef boost::unordered::detail::integral_constant<bool, true> true_type;
|
||||
typedef boost::unordered::detail::integral_constant<bool, false> false_type;
|
||||
typedef boost::unordered::detail::integral_constant<bool, false>
|
||||
false_type;
|
||||
|
||||
#endif
|
||||
|
||||
@ -733,15 +742,14 @@ template <typename T> struct expr_test<T, sizeof(char)> : T
|
||||
|
||||
#define BOOST_UNORDERED_CHECK_EXPRESSION(count, result, expression) \
|
||||
template <typename U> \
|
||||
static typename boost::unordered::detail::expr_test<BOOST_PP_CAT( \
|
||||
choice, result), \
|
||||
static \
|
||||
typename boost::unordered::detail::expr_test<BOOST_PP_CAT(choice, result), \
|
||||
sizeof(for_expr_test(((expression), 0)))>::type \
|
||||
test(BOOST_PP_CAT(choice, count))
|
||||
|
||||
#define BOOST_UNORDERED_DEFAULT_EXPRESSION(count, result) \
|
||||
template <typename U> \
|
||||
static BOOST_PP_CAT(choice, result)::type test( \
|
||||
BOOST_PP_CAT(choice, count))
|
||||
static BOOST_PP_CAT(choice, result)::type test(BOOST_PP_CAT(choice, count))
|
||||
|
||||
#define BOOST_UNORDERED_HAS_FUNCTION(name, thing, args, _) \
|
||||
struct BOOST_PP_CAT(has_, name) \
|
||||
@ -766,8 +774,9 @@ template <typename T> struct identity
|
||||
|
||||
#define BOOST_UNORDERED_CHECK_MEMBER(count, result, name, member) \
|
||||
\
|
||||
typedef typename boost::unordered::detail::identity<member>::type \
|
||||
BOOST_PP_CAT(check, count); \
|
||||
typedef \
|
||||
typename boost::unordered::detail::identity<member>::type BOOST_PP_CAT( \
|
||||
check, count); \
|
||||
\
|
||||
template <BOOST_PP_CAT(check, count) e> struct BOOST_PP_CAT(test, count) \
|
||||
{ \
|
||||
@ -780,8 +789,7 @@ template <typename T> struct identity
|
||||
|
||||
#define BOOST_UNORDERED_DEFAULT_MEMBER(count, result) \
|
||||
template <class U> \
|
||||
static BOOST_PP_CAT(choice, result)::type test( \
|
||||
BOOST_PP_CAT(choice, count))
|
||||
static BOOST_PP_CAT(choice, result)::type test(BOOST_PP_CAT(choice, count))
|
||||
|
||||
#define BOOST_UNORDERED_HAS_MEMBER(name) \
|
||||
struct BOOST_PP_CAT(has_, name) \
|
||||
@ -836,8 +844,8 @@ template <typename Alloc, typename T> struct rebind_alloc;
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <template <typename, typename...> class Alloc, typename U, typename T,
|
||||
typename... Args>
|
||||
template <template <typename, typename...> class Alloc, typename U,
|
||||
typename T, typename... Args>
|
||||
struct rebind_alloc<Alloc<U, Args...>, T>
|
||||
{
|
||||
typedef Alloc<T, Args...> type;
|
||||
@ -851,8 +859,8 @@ struct rebind_alloc<Alloc<U>, T>
|
||||
typedef Alloc<T> type;
|
||||
};
|
||||
|
||||
template <template <typename, typename> class Alloc, typename U, typename T,
|
||||
typename A0>
|
||||
template <template <typename, typename> class Alloc, typename U,
|
||||
typename T, typename A0>
|
||||
struct rebind_alloc<Alloc<U, A0>, T>
|
||||
{
|
||||
typedef Alloc<T, A0> type;
|
||||
@ -887,7 +895,8 @@ template <typename Alloc, typename T> struct rebind_wrap
|
||||
};
|
||||
};
|
||||
|
||||
typedef typename boost::detail::if_true<value>::BOOST_NESTED_TEMPLATE then<
|
||||
typedef
|
||||
typename boost::detail::if_true<value>::BOOST_NESTED_TEMPLATE then<
|
||||
Alloc, fallback>::type::BOOST_NESTED_TEMPLATE rebind<T>::other type;
|
||||
};
|
||||
|
||||
@ -957,8 +966,10 @@ BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(void_pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(const_void_pointer);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(difference_type);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(size_type);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(
|
||||
propagate_on_container_copy_assignment);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(
|
||||
propagate_on_container_move_assignment);
|
||||
BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_swap);
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE_EXPR)
|
||||
@ -967,7 +978,8 @@ template <typename T>
|
||||
BOOST_UNORDERED_HAS_FUNCTION(
|
||||
select_on_container_copy_construction, U const, (), 0);
|
||||
|
||||
template <typename T> BOOST_UNORDERED_HAS_FUNCTION(max_size, U const, (), 0);
|
||||
template <typename T>
|
||||
BOOST_UNORDERED_HAS_FUNCTION(max_size, U const, (), 0);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
@ -998,16 +1010,19 @@ BOOST_UNORDERED_HAS_MEMBER(select_on_container_copy_construction);
|
||||
|
||||
template <typename T> BOOST_UNORDERED_HAS_MEMBER(max_size);
|
||||
|
||||
template <typename T, typename ValueType> BOOST_UNORDERED_HAS_MEMBER(construct);
|
||||
template <typename T, typename ValueType>
|
||||
BOOST_UNORDERED_HAS_MEMBER(construct);
|
||||
|
||||
template <typename T, typename ValueType> BOOST_UNORDERED_HAS_MEMBER(destroy);
|
||||
template <typename T, typename ValueType>
|
||||
BOOST_UNORDERED_HAS_MEMBER(destroy);
|
||||
|
||||
#endif
|
||||
|
||||
namespace func {
|
||||
|
||||
template <typename Alloc>
|
||||
inline Alloc call_select_on_container_copy_construction(const Alloc& rhs,
|
||||
inline Alloc call_select_on_container_copy_construction(
|
||||
const Alloc& rhs,
|
||||
typename boost::enable_if_c<
|
||||
boost::unordered::detail::has_select_on_container_copy_construction<
|
||||
Alloc>::value,
|
||||
@ -1017,7 +1032,8 @@ inline Alloc call_select_on_container_copy_construction(const Alloc& rhs,
|
||||
}
|
||||
|
||||
template <typename Alloc>
|
||||
inline Alloc call_select_on_container_copy_construction(const Alloc& rhs,
|
||||
inline Alloc call_select_on_container_copy_construction(
|
||||
const Alloc& rhs,
|
||||
typename boost::disable_if_c<
|
||||
boost::unordered::detail::has_select_on_container_copy_construction<
|
||||
Alloc>::value,
|
||||
@ -1029,7 +1045,8 @@ inline Alloc call_select_on_container_copy_construction(const Alloc& rhs,
|
||||
template <typename SizeType, typename Alloc>
|
||||
inline SizeType call_max_size(const Alloc& a,
|
||||
typename boost::enable_if_c<
|
||||
boost::unordered::detail::has_max_size<Alloc>::value, void*>::type = 0)
|
||||
boost::unordered::detail::has_max_size<Alloc>::value, void*>::type =
|
||||
0)
|
||||
{
|
||||
return a.max_size();
|
||||
}
|
||||
@ -1037,7 +1054,8 @@ inline SizeType call_max_size(const Alloc& a,
|
||||
template <typename SizeType, typename Alloc>
|
||||
inline SizeType call_max_size(const Alloc&,
|
||||
typename boost::disable_if_c<
|
||||
boost::unordered::detail::has_max_size<Alloc>::value, void*>::type = 0)
|
||||
boost::unordered::detail::has_max_size<Alloc>::value, void*>::type =
|
||||
0)
|
||||
{
|
||||
return (std::numeric_limits<SizeType>::max)();
|
||||
}
|
||||
@ -1049,7 +1067,8 @@ template <typename Alloc> struct allocator_traits
|
||||
typedef Alloc allocator_type;
|
||||
typedef typename Alloc::value_type value_type;
|
||||
|
||||
typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, pointer, value_type*) pointer;
|
||||
typedef BOOST_UNORDERED_DEFAULT_TYPE(
|
||||
Alloc, pointer, value_type*) pointer;
|
||||
|
||||
template <typename T>
|
||||
struct pointer_to_other : boost::pointer_to_other<pointer, T>
|
||||
@ -1099,16 +1118,18 @@ template <typename Alloc> struct allocator_traits
|
||||
#if BOOST_UNORDERED_CXX11_CONSTRUCTION
|
||||
|
||||
template <typename T, typename... Args>
|
||||
static typename boost::enable_if_c<
|
||||
boost::unordered::detail::has_construct<Alloc, T, Args...>::value>::type
|
||||
static
|
||||
typename boost::enable_if_c<boost::unordered::detail::has_construct<
|
||||
Alloc, T, Args...>::value>::type
|
||||
construct(Alloc& a, T* p, BOOST_FWD_REF(Args)... x)
|
||||
{
|
||||
a.construct(p, boost::forward<Args>(x)...);
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
static typename boost::disable_if_c<
|
||||
boost::unordered::detail::has_construct<Alloc, T, Args...>::value>::type
|
||||
static
|
||||
typename boost::disable_if_c<boost::unordered::detail::has_construct<
|
||||
Alloc, T, Args...>::value>::type
|
||||
construct(Alloc&, T* p, BOOST_FWD_REF(Args)... x)
|
||||
{
|
||||
new (static_cast<void*>(p)) T(boost::forward<Args>(x)...);
|
||||
@ -1255,7 +1276,8 @@ namespace boost {
|
||||
namespace unordered {
|
||||
namespace detail {
|
||||
|
||||
template <typename Alloc> struct allocator_traits : std::allocator_traits<Alloc>
|
||||
template <typename Alloc>
|
||||
struct allocator_traits : std::allocator_traits<Alloc>
|
||||
{
|
||||
};
|
||||
|
||||
@ -1365,8 +1387,8 @@ inline void construct_value(T* address, BOOST_FWD_REF(A0) a0)
|
||||
void construct_from_tuple(Alloc&, T* ptr, \
|
||||
namespace_::tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> const& x) \
|
||||
{ \
|
||||
new ((void*)ptr) T( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_)); \
|
||||
new ((void*)ptr) \
|
||||
T(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_)); \
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_GET_TUPLE_ARG(z, n, namespace_) namespace_::get<n>(x)
|
||||
@ -1441,15 +1463,16 @@ template <int N> struct length
|
||||
Alloc&, T* ptr, \
|
||||
namespace_::tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> const& x) \
|
||||
{ \
|
||||
new ((void*)ptr) T( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_)); \
|
||||
new ((void*)ptr) \
|
||||
T(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_)); \
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_GET_TUPLE_ARG(z, n, namespace_) namespace_::get<n>(x)
|
||||
|
||||
template <typename Alloc, typename T>
|
||||
void construct_from_tuple_impl(
|
||||
boost::unordered::detail::func::length<0>, Alloc&, T* ptr, boost::tuple<>)
|
||||
boost::unordered::detail::func::length<0>, Alloc&, T* ptr,
|
||||
boost::tuple<>)
|
||||
{
|
||||
new ((void*)ptr) T();
|
||||
}
|
||||
@ -1483,7 +1506,8 @@ void construct_from_tuple(Alloc& alloc, T* ptr, Tuple const& x)
|
||||
|
||||
template <typename A0> struct use_piecewise
|
||||
{
|
||||
static choice1::type test(choice1, boost::unordered::piecewise_construct_t);
|
||||
static choice1::type test(
|
||||
choice1, boost::unordered::piecewise_construct_t);
|
||||
|
||||
static choice2::type test(choice2, ...);
|
||||
|
||||
@ -1512,10 +1536,11 @@ inline void construct_from_args(
|
||||
|
||||
template <typename A0> struct detect_boost_tuple
|
||||
{
|
||||
template <typename T0, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
static choice1::type test(
|
||||
choice1, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> const&);
|
||||
template <typename T0, typename T1, typename T2, typename T3,
|
||||
typename T4, typename T5, typename T6, typename T7, typename T8,
|
||||
typename T9>
|
||||
static choice1::type test(choice1,
|
||||
boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> const&);
|
||||
|
||||
static choice2::type test(choice2, ...);
|
||||
|
||||
@ -1528,14 +1553,14 @@ template <typename A0> struct detect_boost_tuple
|
||||
|
||||
// Special case for piecewise_construct
|
||||
|
||||
template <typename Alloc, typename A, typename B, typename A0, typename A1,
|
||||
typename A2>
|
||||
template <typename Alloc, typename A, typename B, typename A0,
|
||||
typename A1, typename A2>
|
||||
inline typename boost::enable_if_c<use_piecewise<A0>::value &&
|
||||
detect_boost_tuple<A1>::value &&
|
||||
detect_boost_tuple<A2>::value,
|
||||
void>::type
|
||||
construct_from_args(Alloc& alloc, std::pair<A, B>* address, BOOST_FWD_REF(A0),
|
||||
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
construct_from_args(Alloc& alloc, std::pair<A, B>* address,
|
||||
BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
boost::unordered::detail::func::construct_from_tuple(
|
||||
alloc, boost::addressof(address->first), boost::forward<A1>(a1));
|
||||
@ -1559,18 +1584,19 @@ construct_from_args(Alloc& alloc, std::pair<A, B>* address, BOOST_FWD_REF(A0),
|
||||
// Construct from variadic parameters
|
||||
|
||||
template <typename Alloc, typename T, typename... Args>
|
||||
inline void construct_from_args(Alloc&, T* address, BOOST_FWD_REF(Args)... args)
|
||||
inline void construct_from_args(
|
||||
Alloc&, T* address, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
new ((void*)address) T(boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// Special case for piecewise_construct
|
||||
|
||||
template <typename Alloc, typename A, typename B, typename A0, typename A1,
|
||||
typename A2>
|
||||
inline typename enable_if<use_piecewise<A0>, void>::type construct_from_args(
|
||||
Alloc& alloc, std::pair<A, B>* address, BOOST_FWD_REF(A0),
|
||||
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
template <typename Alloc, typename A, typename B, typename A0,
|
||||
typename A1, typename A2>
|
||||
inline typename enable_if<use_piecewise<A0>, void>::type
|
||||
construct_from_args(Alloc& alloc, std::pair<A, B>* address,
|
||||
BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
boost::unordered::detail::func::construct_from_tuple(
|
||||
alloc, boost::addressof(address->first), boost::forward<A1>(a1));
|
||||
@ -1611,7 +1637,8 @@ inline void construct_from_args(
|
||||
T(boost::forward<A0>(args.a0), boost::forward<A1>(args.a1));
|
||||
}
|
||||
|
||||
template <typename Alloc, typename T, typename A0, typename A1, typename A2>
|
||||
template <typename Alloc, typename T, typename A0, typename A1,
|
||||
typename A2>
|
||||
inline void construct_from_args(
|
||||
Alloc&, T* address, emplace_args3<A0, A1, A2> const& args)
|
||||
{
|
||||
@ -1628,8 +1655,8 @@ inline void construct_from_args(
|
||||
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)); \
|
||||
new ((void*)address) \
|
||||
T(BOOST_PP_ENUM_##z(num_params, BOOST_UNORDERED_CALL_FORWARD, args.a)); \
|
||||
}
|
||||
|
||||
BOOST_UNORDERED_CONSTRUCT_IMPL(1, 4, _)
|
||||
@ -1645,8 +1672,8 @@ BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT),
|
||||
|
||||
// Construct with piecewise_construct
|
||||
|
||||
template <typename Alloc, typename A, typename B, typename A0, typename A1,
|
||||
typename A2>
|
||||
template <typename Alloc, typename A, typename B, typename A0,
|
||||
typename A1, typename A2>
|
||||
inline void construct_from_args(Alloc& alloc, std::pair<A, B>* address,
|
||||
boost::unordered::detail::emplace_args3<A0, A1, A2> const& args,
|
||||
typename enable_if<use_piecewise<A0>, void*>::type = 0)
|
||||
@ -1781,7 +1808,8 @@ namespace func {
|
||||
// improve implementation later.
|
||||
|
||||
template <typename Alloc, BOOST_UNORDERED_EMPLACE_TEMPLATE>
|
||||
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
inline
|
||||
typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node_from_args(Alloc& alloc, BOOST_UNORDERED_EMPLACE_ARGS)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
@ -1792,7 +1820,8 @@ construct_node_from_args(Alloc& alloc, BOOST_UNORDERED_EMPLACE_ARGS)
|
||||
}
|
||||
|
||||
template <typename Alloc, typename U>
|
||||
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
inline
|
||||
typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node(Alloc& alloc, BOOST_FWD_REF(U) x)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
@ -1806,20 +1835,24 @@ construct_node(Alloc& alloc, BOOST_FWD_REF(U) x)
|
||||
#if BOOST_UNORDERED_CXX11_CONSTRUCTION
|
||||
|
||||
template <typename Alloc, typename Key>
|
||||
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
inline
|
||||
typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
a.create_node();
|
||||
boost::unordered::detail::allocator_traits<Alloc>::construct(alloc,
|
||||
a.node_->value_ptr(), std::piecewise_construct,
|
||||
std::forward_as_tuple(boost::forward<Key>(k)), std::forward_as_tuple());
|
||||
std::forward_as_tuple(boost::forward<Key>(k)),
|
||||
std::forward_as_tuple());
|
||||
return a.release();
|
||||
}
|
||||
|
||||
template <typename Alloc, typename Key, typename Mapped>
|
||||
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m)
|
||||
inline
|
||||
typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node_pair(
|
||||
Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
a.create_node();
|
||||
@ -1831,7 +1864,8 @@ construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m)
|
||||
}
|
||||
|
||||
template <typename Alloc, typename Key, typename... Args>
|
||||
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
inline
|
||||
typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node_pair_from_args(
|
||||
Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
@ -1846,7 +1880,8 @@ construct_node_pair_from_args(
|
||||
#else
|
||||
// It doesn't seem to be possible to construct a tuple with 3 variadic
|
||||
// rvalue reference members when using older versions of clang with
|
||||
// libstdc++, so just use std::make_tuple instead of std::forward_as_tuple.
|
||||
// libstdc++, so just use std::make_tuple instead of
|
||||
// std::forward_as_tuple.
|
||||
boost::unordered::detail::allocator_traits<Alloc>::construct(alloc,
|
||||
a.node_->value_ptr(), std::piecewise_construct,
|
||||
std::forward_as_tuple(boost::forward<Key>(k)),
|
||||
@ -1858,13 +1893,15 @@ construct_node_pair_from_args(
|
||||
#else
|
||||
|
||||
template <typename Alloc, typename Key>
|
||||
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
inline
|
||||
typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
a.create_node();
|
||||
boost::unordered::detail::func::construct_value(
|
||||
boost::addressof(a.node_->value_ptr()->first), boost::forward<Key>(k));
|
||||
boost::addressof(a.node_->value_ptr()->first),
|
||||
boost::forward<Key>(k));
|
||||
BOOST_TRY
|
||||
{
|
||||
boost::unordered::detail::func::construct_value(
|
||||
@ -1881,13 +1918,16 @@ construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k)
|
||||
}
|
||||
|
||||
template <typename Alloc, typename Key, typename Mapped>
|
||||
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m)
|
||||
inline
|
||||
typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node_pair(
|
||||
Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
a.create_node();
|
||||
boost::unordered::detail::func::construct_value(
|
||||
boost::addressof(a.node_->value_ptr()->first), boost::forward<Key>(k));
|
||||
boost::addressof(a.node_->value_ptr()->first),
|
||||
boost::forward<Key>(k));
|
||||
BOOST_TRY
|
||||
{
|
||||
boost::unordered::detail::func::construct_value(
|
||||
@ -1904,15 +1944,18 @@ construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m)
|
||||
return a.release();
|
||||
}
|
||||
|
||||
template <typename Alloc, typename Key, BOOST_UNORDERED_EMPLACE_TEMPLATE>
|
||||
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
template <typename Alloc, typename Key,
|
||||
BOOST_UNORDERED_EMPLACE_TEMPLATE>
|
||||
inline
|
||||
typename boost::unordered::detail::allocator_traits<Alloc>::pointer
|
||||
construct_node_pair_from_args(
|
||||
Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_UNORDERED_EMPLACE_ARGS)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
a.create_node();
|
||||
boost::unordered::detail::func::construct_value(
|
||||
boost::addressof(a.node_->value_ptr()->first), boost::forward<Key>(k));
|
||||
boost::addressof(a.node_->value_ptr()->first),
|
||||
boost::forward<Key>(k));
|
||||
BOOST_TRY
|
||||
{
|
||||
boost::unordered::detail::func::construct_from_args(alloc,
|
||||
@ -1953,7 +1996,8 @@ namespace iterator_detail {
|
||||
// all no throw
|
||||
|
||||
template <typename Node>
|
||||
struct l_iterator : public std::iterator<std::forward_iterator_tag,
|
||||
struct l_iterator
|
||||
: public std::iterator<std::forward_iterator_tag,
|
||||
typename Node::value_type, std::ptrdiff_t,
|
||||
typename Node::value_type*, typename Node::value_type&>
|
||||
{
|
||||
@ -2012,9 +2056,9 @@ struct l_iterator : public std::iterator<std::forward_iterator_tag,
|
||||
|
||||
template <typename Node>
|
||||
struct cl_iterator
|
||||
: public std::iterator<std::forward_iterator_tag, typename Node::value_type,
|
||||
std::ptrdiff_t, typename Node::value_type const*,
|
||||
typename Node::value_type const&>
|
||||
: public std::iterator<std::forward_iterator_tag,
|
||||
typename Node::value_type, std::ptrdiff_t,
|
||||
typename Node::value_type const*, typename Node::value_type const&>
|
||||
{
|
||||
friend struct boost::unordered::iterator_detail::l_iterator<Node>;
|
||||
|
||||
@ -2036,7 +2080,8 @@ struct cl_iterator
|
||||
{
|
||||
}
|
||||
|
||||
cl_iterator(boost::unordered::iterator_detail::l_iterator<Node> const& x)
|
||||
cl_iterator(
|
||||
boost::unordered::iterator_detail::l_iterator<Node> const& x)
|
||||
BOOST_NOEXCEPT : ptr_(x.ptr_),
|
||||
bucket_(x.bucket_),
|
||||
bucket_count_(x.bucket_count_)
|
||||
@ -2076,7 +2121,8 @@ struct cl_iterator
|
||||
};
|
||||
|
||||
template <typename Node>
|
||||
struct iterator : public std::iterator<std::forward_iterator_tag,
|
||||
struct iterator
|
||||
: public std::iterator<std::forward_iterator_tag,
|
||||
typename Node::value_type, std::ptrdiff_t,
|
||||
typename Node::value_type*, typename Node::value_type&>
|
||||
{
|
||||
@ -2130,9 +2176,9 @@ struct iterator : public std::iterator<std::forward_iterator_tag,
|
||||
|
||||
template <typename Node>
|
||||
struct c_iterator
|
||||
: public std::iterator<std::forward_iterator_tag, typename Node::value_type,
|
||||
std::ptrdiff_t, typename Node::value_type const*,
|
||||
typename Node::value_type const&>
|
||||
: public std::iterator<std::forward_iterator_tag,
|
||||
typename Node::value_type, std::ptrdiff_t,
|
||||
typename Node::value_type const*, typename Node::value_type const&>
|
||||
{
|
||||
friend struct boost::unordered::iterator_detail::iterator<Node>;
|
||||
|
||||
@ -2400,7 +2446,8 @@ template <> struct pick_policy_impl<64, 2>
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct pick_policy2 : pick_policy_impl<std::numeric_limits<std::size_t>::digits,
|
||||
struct pick_policy2
|
||||
: pick_policy_impl<std::numeric_limits<std::size_t>::digits,
|
||||
std::numeric_limits<std::size_t>::radix>
|
||||
{
|
||||
};
|
||||
@ -2463,7 +2510,8 @@ struct pick_policy : pick_policy2<typename boost::remove_cv<T>::type>
|
||||
// atomically assigns the new function objects in a strongly
|
||||
// exception safe manner.
|
||||
|
||||
template <class H, class P, bool NoThrowMoveAssign> class set_hash_functions;
|
||||
template <class H, class P, bool NoThrowMoveAssign>
|
||||
class set_hash_functions;
|
||||
|
||||
template <class H, class P> class functions
|
||||
{
|
||||
@ -2635,8 +2683,8 @@ template <typename T> struct rv_ref_impl
|
||||
|
||||
template <typename T>
|
||||
struct rv_ref
|
||||
: boost::detail::if_true<boost::is_class<T>::value>::BOOST_NESTED_TEMPLATE
|
||||
then<boost::unordered::detail::rv_ref_impl<T>,
|
||||
: boost::detail::if_true<boost::is_class<T>::value>::
|
||||
BOOST_NESTED_TEMPLATE then<boost::unordered::detail::rv_ref_impl<T>,
|
||||
please_ignore_this_overload>::type
|
||||
{
|
||||
};
|
||||
@ -2655,7 +2703,8 @@ struct rv_ref
|
||||
|
||||
inline std::size_t double_to_size(double f)
|
||||
{
|
||||
return f >= static_cast<double>((std::numeric_limits<std::size_t>::max)())
|
||||
return f >= static_cast<double>(
|
||||
(std::numeric_limits<std::size_t>::max)())
|
||||
? (std::numeric_limits<std::size_t>::max)()
|
||||
: static_cast<std::size_t>(f);
|
||||
}
|
||||
@ -2724,7 +2773,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
typedef boost::unordered::detail::allocator_traits<bucket_allocator>
|
||||
bucket_allocator_traits;
|
||||
typedef typename node_allocator_traits::pointer node_pointer;
|
||||
typedef typename node_allocator_traits::const_pointer const_node_pointer;
|
||||
typedef
|
||||
typename node_allocator_traits::const_pointer const_node_pointer;
|
||||
typedef typename bucket_allocator_traits::pointer bucket_pointer;
|
||||
typedef boost::unordered::detail::node_constructor<node_allocator>
|
||||
node_constructor;
|
||||
@ -2783,11 +2833,20 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
return x;
|
||||
}
|
||||
|
||||
std::size_t node_bucket(node_pointer n) const { return n->get_bucket(); }
|
||||
std::size_t node_bucket(node_pointer n) const
|
||||
{
|
||||
return n->get_bucket();
|
||||
}
|
||||
|
||||
bucket_allocator const& bucket_alloc() const { return allocators_.first(); }
|
||||
bucket_allocator const& bucket_alloc() const
|
||||
{
|
||||
return allocators_.first();
|
||||
}
|
||||
|
||||
node_allocator const& node_alloc() const { return allocators_.second(); }
|
||||
node_allocator const& node_alloc() const
|
||||
{
|
||||
return allocators_.second();
|
||||
}
|
||||
|
||||
bucket_allocator& bucket_alloc() { return allocators_.first(); }
|
||||
|
||||
@ -2920,10 +2979,11 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
x.max_load_ = 0;
|
||||
}
|
||||
|
||||
table(
|
||||
table& x, node_allocator const& a, boost::unordered::detail::move_tag m)
|
||||
: functions(x, m), allocators_(a, a), bucket_count_(x.bucket_count_),
|
||||
size_(0), mlf_(x.mlf_), max_load_(0), buckets_()
|
||||
table(table& x, node_allocator const& a,
|
||||
boost::unordered::detail::move_tag m)
|
||||
: functions(x, m), allocators_(a, a),
|
||||
bucket_count_(x.bucket_count_), size_(0), mlf_(x.mlf_),
|
||||
max_load_(0), buckets_()
|
||||
{
|
||||
}
|
||||
|
||||
@ -2947,7 +3007,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
}
|
||||
}
|
||||
|
||||
// Create container buckets. If the container already contains any buckets
|
||||
// Create container buckets. If the container already contains any
|
||||
// buckets
|
||||
// the linked list will be transferred to the new buckets, but none
|
||||
// of the bucket pointers will be set. See above note.
|
||||
//
|
||||
@ -2956,31 +3017,33 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
{
|
||||
link_pointer dummy_node;
|
||||
|
||||
// Construct the new buckets and dummy node, and destroy the old buckets
|
||||
// Construct the new buckets and dummy node, and destroy the old
|
||||
// buckets
|
||||
if (buckets_) {
|
||||
dummy_node =
|
||||
(buckets_ + static_cast<std::ptrdiff_t>(bucket_count_))->next_;
|
||||
bucket_pointer new_buckets = bucket_allocator_traits::allocate(
|
||||
bucket_alloc(), new_count + 1);
|
||||
bucket_pointer new_buckets =
|
||||
bucket_allocator_traits::allocate(bucket_alloc(), new_count + 1);
|
||||
destroy_buckets();
|
||||
buckets_ = new_buckets;
|
||||
} else if (bucket::extra_node) {
|
||||
node_constructor a(node_alloc());
|
||||
a.create_node();
|
||||
buckets_ = bucket_allocator_traits::allocate(
|
||||
bucket_alloc(), new_count + 1);
|
||||
buckets_ =
|
||||
bucket_allocator_traits::allocate(bucket_alloc(), new_count + 1);
|
||||
dummy_node = a.release();
|
||||
} else {
|
||||
dummy_node = link_pointer();
|
||||
buckets_ = bucket_allocator_traits::allocate(
|
||||
bucket_alloc(), new_count + 1);
|
||||
buckets_ =
|
||||
bucket_allocator_traits::allocate(bucket_alloc(), new_count + 1);
|
||||
}
|
||||
|
||||
// nothrow from here...
|
||||
bucket_count_ = new_count;
|
||||
recalculate_max_load();
|
||||
|
||||
bucket_pointer end = buckets_ + static_cast<std::ptrdiff_t>(new_count);
|
||||
bucket_pointer end =
|
||||
buckets_ + static_cast<std::ptrdiff_t>(new_count);
|
||||
for (bucket_pointer i = buckets_; i != end; ++i) {
|
||||
new (pointer<void>::get(i)) bucket();
|
||||
}
|
||||
@ -3094,7 +3157,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Fix buckets after delete/extract
|
||||
//
|
||||
// (prev,next) should mark an open range of nodes in a single bucket which
|
||||
// (prev,next) should mark an open range of nodes in a single bucket
|
||||
// which
|
||||
// have either been unlinked, or are about to be.
|
||||
|
||||
std::size_t fix_bucket(
|
||||
@ -3191,8 +3255,7 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
void move_assign(table& x, UniqueType is_unique)
|
||||
{
|
||||
if (this != &x) {
|
||||
move_assign(
|
||||
x, is_unique,
|
||||
move_assign(x, is_unique,
|
||||
boost::unordered::detail::integral_constant<bool,
|
||||
allocator_traits<node_allocator>::
|
||||
propagate_on_container_move_assignment::value>());
|
||||
@ -3284,7 +3347,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
}
|
||||
|
||||
// Find the node before the key, so that it can be erased.
|
||||
link_pointer find_previous_node(const_key_type& k, std::size_t bucket_index)
|
||||
link_pointer find_previous_node(
|
||||
const_key_type& k, std::size_t bucket_index)
|
||||
{
|
||||
link_pointer prev = this->get_previous_start(bucket_index);
|
||||
if (!prev) {
|
||||
@ -3361,7 +3425,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
|
||||
// Emplace/Insert
|
||||
|
||||
inline node_pointer add_node_unique(node_pointer n, std::size_t key_hash)
|
||||
inline node_pointer add_node_unique(
|
||||
node_pointer n, std::size_t key_hash)
|
||||
{
|
||||
std::size_t bucket_index = this->hash_to_bucket(key_hash);
|
||||
bucket_pointer b = this->get_bucket(bucket_index);
|
||||
@ -3459,8 +3524,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
if (pos) {
|
||||
return emplace_return(iterator(pos), false);
|
||||
} else {
|
||||
return emplace_return(iterator(this->resize_and_add_node_unique(
|
||||
b.release(), key_hash)),
|
||||
return emplace_return(
|
||||
iterator(this->resize_and_add_node_unique(b.release(), key_hash)),
|
||||
true);
|
||||
}
|
||||
}
|
||||
@ -3503,9 +3568,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
} else {
|
||||
return emplace_return(
|
||||
iterator(this->resize_and_add_node_unique(
|
||||
boost::unordered::detail::func::
|
||||
construct_node_pair_from_args(this->node_alloc(),
|
||||
boost::forward<Key>(k),
|
||||
boost::unordered::detail::func::construct_node_pair_from_args(
|
||||
this->node_alloc(), boost::forward<Key>(k),
|
||||
BOOST_UNORDERED_EMPLACE_FORWARD),
|
||||
key_hash)),
|
||||
true);
|
||||
@ -3545,7 +3609,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
}
|
||||
|
||||
template <typename NodeType, typename InsertReturnType>
|
||||
void move_insert_node_type_unique(NodeType& np, InsertReturnType& result)
|
||||
void move_insert_node_type_unique(
|
||||
NodeType& np, InsertReturnType& result)
|
||||
{
|
||||
if (np) {
|
||||
const_key_type& k = this->get_key(np.ptr_);
|
||||
@ -3820,8 +3885,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool group_equals_equiv(
|
||||
node_pointer n1, node_pointer end1, node_pointer n2, node_pointer end2)
|
||||
static bool group_equals_equiv(node_pointer n1, node_pointer end1,
|
||||
node_pointer n2, node_pointer end2)
|
||||
{
|
||||
for (;;) {
|
||||
if (n1->value() != n2->value())
|
||||
@ -3927,7 +3992,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
return n;
|
||||
}
|
||||
|
||||
inline node_pointer add_using_hint_equiv(node_pointer n, node_pointer hint)
|
||||
inline node_pointer add_using_hint_equiv(
|
||||
node_pointer n, node_pointer hint)
|
||||
{
|
||||
n->bucket_info_ = hint->bucket_info_;
|
||||
n->reset_first_in_group();
|
||||
@ -3950,7 +4016,8 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
std::size_t key_hash = this->hash(k);
|
||||
node_pointer position = this->find_node(key_hash, k);
|
||||
this->reserve_for_insert(this->size_ + 1);
|
||||
return iterator(this->add_node_equiv(a.release(), key_hash, position));
|
||||
return iterator(
|
||||
this->add_node_equiv(a.release(), key_hash, position));
|
||||
}
|
||||
|
||||
iterator emplace_hint_equiv(c_iterator hint, node_pointer n)
|
||||
@ -4051,9 +4118,9 @@ struct table : boost::unordered::detail::functions<typename Types::hasher,
|
||||
}
|
||||
|
||||
template <class I>
|
||||
void insert_range_equiv(I i, I j,
|
||||
typename boost::unordered::detail::disable_if_forward<I, void*>::type =
|
||||
0)
|
||||
void insert_range_equiv(
|
||||
I i, I j, typename boost::unordered::detail::disable_if_forward<I,
|
||||
void*>::type = 0)
|
||||
{
|
||||
for (; i != j; ++i) {
|
||||
emplace_equiv(boost::unordered::detail::func::construct_node(
|
||||
@ -4350,7 +4417,8 @@ inline void table<Types>::rehash_impl(std::size_t num_buckets)
|
||||
//
|
||||
// 'extract_key' is called with the emplace parameters to return a
|
||||
// key if available or 'no_key' is one isn't and will need to be
|
||||
// constructed. This could be done by overloading the emplace implementation
|
||||
// constructed. This could be done by overloading the emplace
|
||||
// implementation
|
||||
// for the different cases, but that's a bit tricky on compilers without
|
||||
// variadic templates.
|
||||
|
||||
@ -4383,7 +4451,10 @@ template <class ValueType> struct set_extractor
|
||||
|
||||
static no_key extract() { return no_key(); }
|
||||
|
||||
template <class Arg> static no_key extract(Arg const&) { return no_key(); }
|
||||
template <class Arg> static no_key extract(Arg const&)
|
||||
{
|
||||
return no_key();
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class Arg1, class Arg2, class... Args>
|
||||
@ -4415,7 +4486,8 @@ template <class ValueType> struct map_extractor
|
||||
}
|
||||
|
||||
template <class Second>
|
||||
static key_type const& extract(std::pair<key_type const, Second> const& v)
|
||||
static key_type const& extract(
|
||||
std::pair<key_type const, Second> const& v)
|
||||
{
|
||||
return v.first;
|
||||
}
|
||||
@ -4444,7 +4516,10 @@ template <class ValueType> struct map_extractor
|
||||
|
||||
static no_key extract() { return no_key(); }
|
||||
|
||||
template <class Arg> static no_key extract(Arg const&) { return no_key(); }
|
||||
template <class Arg> static no_key extract(Arg const&)
|
||||
{
|
||||
return no_key();
|
||||
}
|
||||
|
||||
template <class Arg1, class Arg2>
|
||||
static no_key extract(Arg1 const&, Arg2 const&)
|
||||
@ -4454,7 +4529,8 @@ template <class ValueType> struct map_extractor
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class Arg1, class Arg2, class Arg3, class... Args>
|
||||
static no_key extract(Arg1 const&, Arg2 const&, Arg3 const&, Args const&...)
|
||||
static no_key extract(
|
||||
Arg1 const&, Arg2 const&, Arg3 const&, Args const&...)
|
||||
{
|
||||
return no_key();
|
||||
}
|
||||
@ -4550,7 +4626,8 @@ struct node : boost::unordered::detail::value_base<T>
|
||||
node& operator=(node const&);
|
||||
};
|
||||
|
||||
template <typename T> struct ptr_node : boost::unordered::detail::ptr_bucket
|
||||
template <typename T>
|
||||
struct ptr_node : boost::unordered::detail::ptr_bucket
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef boost::unordered::detail::ptr_bucket bucket_base;
|
||||
@ -4600,8 +4677,8 @@ struct pick_node2
|
||||
typedef boost::unordered::detail::node<A, T> node;
|
||||
|
||||
typedef typename boost::unordered::detail::allocator_traits<
|
||||
typename boost::unordered::detail::rebind_wrap<A, node>::type>::pointer
|
||||
node_pointer;
|
||||
typename boost::unordered::detail::rebind_wrap<A,
|
||||
node>::type>::pointer node_pointer;
|
||||
|
||||
typedef boost::unordered::detail::bucket<node_pointer> bucket;
|
||||
typedef node_pointer link_pointer;
|
||||
|
@ -9,7 +9,8 @@
|
||||
namespace boost {
|
||||
namespace unordered {
|
||||
namespace detail {
|
||||
template <typename A, typename K, typename M, typename H, typename P> struct map
|
||||
template <typename A, typename K, typename M, typename H, typename P>
|
||||
struct map
|
||||
{
|
||||
typedef boost::unordered::detail::map<A, K, M, H, P> types;
|
||||
|
||||
@ -36,7 +37,8 @@ template <typename A, typename K, typename M, typename H, typename P> struct map
|
||||
typedef boost::unordered::iterator_detail::iterator<node> iterator;
|
||||
typedef boost::unordered::iterator_detail::c_iterator<node> c_iterator;
|
||||
typedef boost::unordered::iterator_detail::l_iterator<node> l_iterator;
|
||||
typedef boost::unordered::iterator_detail::cl_iterator<node> cl_iterator;
|
||||
typedef boost::unordered::iterator_detail::cl_iterator<node>
|
||||
cl_iterator;
|
||||
|
||||
typedef boost::unordered::node_handle_map<node, K, M, A> node_type;
|
||||
typedef boost::unordered::insert_return_type_map<node, K, M, A>
|
||||
|
@ -36,14 +36,16 @@ template <typename A, typename T, typename H, typename P> struct set
|
||||
typedef boost::unordered::iterator_detail::c_iterator<node> iterator;
|
||||
typedef boost::unordered::iterator_detail::c_iterator<node> c_iterator;
|
||||
typedef boost::unordered::iterator_detail::cl_iterator<node> l_iterator;
|
||||
typedef boost::unordered::iterator_detail::cl_iterator<node> cl_iterator;
|
||||
typedef boost::unordered::iterator_detail::cl_iterator<node>
|
||||
cl_iterator;
|
||||
|
||||
typedef boost::unordered::node_handle_set<node, T, A> node_type;
|
||||
typedef boost::unordered::insert_return_type_set<node, T, A>
|
||||
insert_return_type;
|
||||
};
|
||||
|
||||
template <typename T, typename H, typename P, typename A> class instantiate_set
|
||||
template <typename T, typename H, typename P, typename A>
|
||||
class instantiate_set
|
||||
{
|
||||
typedef boost::unordered_set<T, H, P, A> container;
|
||||
container x;
|
||||
|
@ -273,9 +273,8 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1), boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -317,11 +316,11 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator emplace_hint(
|
||||
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
@ -331,9 +330,8 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1), boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -353,8 +351,8 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
} \
|
||||
\
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
iterator emplace_hint( \
|
||||
const_iterator hint, BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.emplace_hint_unique( \
|
||||
hint, table::extractor::extract( \
|
||||
@ -535,9 +533,9 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_unique(
|
||||
k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
k,
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1), boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
// try_emplace(key&&, Args&&...)
|
||||
@ -556,8 +554,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.try_emplace_unique(
|
||||
boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::move(k), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
@ -566,9 +563,9 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_unique(
|
||||
boost::move(k), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1), boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
// try_emplace(const_iterator hint, key const&, Args&&...)
|
||||
@ -596,9 +593,9 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, k, boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
hint, k,
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1), boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
// try_emplace(const_iterator hint, key&&, Args&&...)
|
||||
@ -616,10 +613,9 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
return table_.try_emplace_hint_unique(hint, boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
@ -628,9 +624,8 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, boost::move(k),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1), boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_TRY_EMPLACE(z, n, _) \
|
||||
@ -657,9 +652,9 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
iterator try_emplace(const_iterator hint, key_type const& k, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.try_emplace_hint_unique(hint, k, \
|
||||
boost::unordered::detail::create_emplace_args(BOOST_PP_ENUM_##z( \
|
||||
n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
return table_.try_emplace_hint_unique( \
|
||||
hint, k, boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
} \
|
||||
\
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
@ -809,7 +804,10 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
|
||||
local_iterator end(size_type) { return local_iterator(); }
|
||||
|
||||
const_local_iterator end(size_type) const { return const_local_iterator(); }
|
||||
const_local_iterator end(size_type) const
|
||||
{
|
||||
return const_local_iterator();
|
||||
}
|
||||
|
||||
const_local_iterator cbegin(size_type n) const
|
||||
{
|
||||
@ -837,7 +835,8 @@ template <class K, class T, class H, class P, class A> class unordered_map
|
||||
#endif
|
||||
}; // class template unordered_map
|
||||
|
||||
template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
template <class K, class T, class H, class P, class A>
|
||||
class unordered_multimap
|
||||
{
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
BOOST_COPYABLE_AND_MOVABLE(unordered_multimap)
|
||||
@ -910,7 +909,8 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
|
||||
unordered_multimap(unordered_multimap const&, allocator_type const&);
|
||||
|
||||
unordered_multimap(BOOST_RV_REF(unordered_multimap), allocator_type const&);
|
||||
unordered_multimap(
|
||||
BOOST_RV_REF(unordered_multimap), allocator_type const&);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
unordered_multimap(std::initializer_list<value_type>,
|
||||
@ -1050,8 +1050,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
{
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
table_.node_alloc(), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)))));
|
||||
}
|
||||
|
||||
@ -1107,9 +1106,9 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
hint,
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)))));
|
||||
}
|
||||
|
||||
@ -1152,12 +1151,11 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
} \
|
||||
\
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
iterator emplace_hint( \
|
||||
const_iterator hint, BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return iterator(table_.emplace_hint_equiv( \
|
||||
hint, \
|
||||
boost::unordered::detail::func::construct_node_from_args( \
|
||||
hint, boost::unordered::detail::func::construct_node_from_args( \
|
||||
table_.node_alloc(), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))))); \
|
||||
@ -1339,7 +1337,10 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
|
||||
|
||||
local_iterator end(size_type) { return local_iterator(); }
|
||||
|
||||
const_local_iterator end(size_type) const { return const_local_iterator(); }
|
||||
const_local_iterator end(size_type) const
|
||||
{
|
||||
return const_local_iterator();
|
||||
}
|
||||
|
||||
const_local_iterator cbegin(size_type n) const
|
||||
{
|
||||
@ -1385,8 +1386,9 @@ unordered_map<K, T, H, P, A>::unordered_map(size_type n, const hasher& hf,
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
unordered_map<K, T, H, P, A>::unordered_map(InputIt f, InputIt l, size_type n,
|
||||
const hasher& hf, const key_equal& eql, const allocator_type& a)
|
||||
unordered_map<K, T, H, P, A>::unordered_map(InputIt f, InputIt l,
|
||||
size_type n, const hasher& hf, const key_equal& eql,
|
||||
const allocator_type& a)
|
||||
: table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a)
|
||||
{
|
||||
this->insert(f, l);
|
||||
@ -1476,8 +1478,8 @@ unordered_map<K, T, H, P, A>::unordered_map(
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
unordered_map<K, T, H, P, A>::unordered_map(InputIt f, InputIt l, size_type n,
|
||||
const hasher& hf, const allocator_type& a)
|
||||
unordered_map<K, T, H, P, A>::unordered_map(InputIt f, InputIt l,
|
||||
size_type n, const hasher& hf, const allocator_type& a)
|
||||
: table_(
|
||||
boost::unordered::detail::initial_size(f, l, n), hf, key_equal(), a)
|
||||
{
|
||||
@ -1594,7 +1596,8 @@ unordered_map<K, T, H, P, A>::erase(const key_type& k)
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
typename unordered_map<K, T, H, P, A>::iterator
|
||||
unordered_map<K, T, H, P, A>::erase(const_iterator first, const_iterator last)
|
||||
unordered_map<K, T, H, P, A>::erase(
|
||||
const_iterator first, const_iterator last)
|
||||
{
|
||||
node_pointer last_node = table::get_node(last);
|
||||
if (first == last)
|
||||
@ -1682,7 +1685,8 @@ unordered_map<K, T, H, P, A>::find(const key_type& k) const
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate>
|
||||
template <class CompatibleKey, class CompatibleHash,
|
||||
class CompatiblePredicate>
|
||||
typename unordered_map<K, T, H, P, A>::iterator
|
||||
unordered_map<K, T, H, P, A>::find(CompatibleKey const& k,
|
||||
CompatibleHash const& hash, CompatiblePredicate const& eq)
|
||||
@ -1692,7 +1696,8 @@ unordered_map<K, T, H, P, A>::find(CompatibleKey const& k,
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate>
|
||||
template <class CompatibleKey, class CompatibleHash,
|
||||
class CompatiblePredicate>
|
||||
typename unordered_map<K, T, H, P, A>::const_iterator
|
||||
unordered_map<K, T, H, P, A>::find(CompatibleKey const& k,
|
||||
CompatibleHash const& hash, CompatiblePredicate const& eq) const
|
||||
@ -1885,7 +1890,8 @@ unordered_multimap<K, T, H, P, A>::unordered_multimap(
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
unordered_multimap<K, T, H, P, A>::unordered_multimap(allocator_type const& a)
|
||||
unordered_multimap<K, T, H, P, A>::unordered_multimap(
|
||||
allocator_type const& a)
|
||||
: table_(boost::unordered::detail::default_bucket_count, hasher(),
|
||||
key_equal(), a)
|
||||
{
|
||||
@ -1998,8 +2004,8 @@ unordered_multimap<K, T, H, P, A>::~unordered_multimap() BOOST_NOEXCEPT
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
unordered_multimap<K, T, H, P, A>& unordered_multimap<K, T, H, P, A>::operator=(
|
||||
std::initializer_list<value_type> list)
|
||||
unordered_multimap<K, T, H, P, A>& unordered_multimap<K, T, H, P, A>::
|
||||
operator=(std::initializer_list<value_type> list)
|
||||
{
|
||||
this->clear();
|
||||
this->insert(list.begin(), list.end());
|
||||
@ -2011,7 +2017,8 @@ unordered_multimap<K, T, H, P, A>& unordered_multimap<K, T, H, P, A>::operator=(
|
||||
// size and capacity
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
std::size_t unordered_multimap<K, T, H, P, A>::max_size() const BOOST_NOEXCEPT
|
||||
std::size_t
|
||||
unordered_multimap<K, T, H, P, A>::max_size() const BOOST_NOEXCEPT
|
||||
{
|
||||
using namespace std;
|
||||
|
||||
@ -2168,7 +2175,8 @@ unordered_multimap<K, T, H, P, A>::find(const key_type& k) const
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate>
|
||||
template <class CompatibleKey, class CompatibleHash,
|
||||
class CompatiblePredicate>
|
||||
typename unordered_multimap<K, T, H, P, A>::iterator
|
||||
unordered_multimap<K, T, H, P, A>::find(CompatibleKey const& k,
|
||||
CompatibleHash const& hash, CompatiblePredicate const& eq)
|
||||
@ -2178,7 +2186,8 @@ unordered_multimap<K, T, H, P, A>::find(CompatibleKey const& k,
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate>
|
||||
template <class CompatibleKey, class CompatibleHash,
|
||||
class CompatiblePredicate>
|
||||
typename unordered_multimap<K, T, H, P, A>::const_iterator
|
||||
unordered_multimap<K, T, H, P, A>::find(CompatibleKey const& k,
|
||||
CompatibleHash const& hash, CompatiblePredicate const& eq) const
|
||||
@ -2201,7 +2210,8 @@ std::pair<typename unordered_multimap<K, T, H, P, A>::iterator,
|
||||
unordered_multimap<K, T, H, P, A>::equal_range(const key_type& k)
|
||||
{
|
||||
node_pointer n = table_.find_node(k);
|
||||
return std::make_pair(iterator(n), iterator(n ? table_.next_group(n) : n));
|
||||
return std::make_pair(
|
||||
iterator(n), iterator(n ? table_.next_group(n) : n));
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
@ -2232,7 +2242,8 @@ float unordered_multimap<K, T, H, P, A>::load_factor() const BOOST_NOEXCEPT
|
||||
}
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
void unordered_multimap<K, T, H, P, A>::max_load_factor(float m) BOOST_NOEXCEPT
|
||||
void unordered_multimap<K, T, H, P, A>::max_load_factor(
|
||||
float m) BOOST_NOEXCEPT
|
||||
{
|
||||
table_.max_load_factor(m);
|
||||
}
|
||||
@ -2331,7 +2342,8 @@ template <typename N, class K, class T, class A> class node_handle_map
|
||||
}
|
||||
|
||||
public:
|
||||
BOOST_CONSTEXPR node_handle_map() BOOST_NOEXCEPT : ptr_(), has_alloc_(false)
|
||||
BOOST_CONSTEXPR node_handle_map() BOOST_NOEXCEPT : ptr_(),
|
||||
has_alloc_(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -2389,7 +2401,10 @@ template <typename N, class K, class T, class A> class node_handle_map
|
||||
return *this;
|
||||
}
|
||||
|
||||
key_type& key() const { return const_cast<key_type&>(ptr_->value().first); }
|
||||
key_type& key() const
|
||||
{
|
||||
return const_cast<key_type&>(ptr_->value().first);
|
||||
}
|
||||
|
||||
mapped_type& mapped() const { return ptr_->value().second; }
|
||||
|
||||
@ -2412,9 +2427,9 @@ template <typename N, class K, class T, class A> class node_handle_map
|
||||
} else if (!n.has_alloc_) {
|
||||
n.move_allocator(*this);
|
||||
} else {
|
||||
swap_impl(n, boost::unordered::detail::integral_constant<bool,
|
||||
value_allocator_traits::
|
||||
propagate_on_container_swap::value>());
|
||||
swap_impl(
|
||||
n, boost::unordered::detail::integral_constant<bool,
|
||||
value_allocator_traits::propagate_on_container_swap::value>());
|
||||
}
|
||||
boost::swap(ptr_, n.ptr_);
|
||||
}
|
||||
|
@ -271,9 +271,8 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1), boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -315,11 +314,11 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
iterator emplace_hint(
|
||||
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
@ -329,9 +328,8 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2)));
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1), boost::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -351,8 +349,8 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
} \
|
||||
\
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
iterator emplace_hint( \
|
||||
const_iterator hint, BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.emplace_hint_unique( \
|
||||
hint, table::extractor::extract( \
|
||||
@ -516,7 +514,10 @@ template <class T, class H, class P, class A> class unordered_set
|
||||
|
||||
local_iterator end(size_type) { return local_iterator(); }
|
||||
|
||||
const_local_iterator end(size_type) const { return const_local_iterator(); }
|
||||
const_local_iterator end(size_type) const
|
||||
{
|
||||
return const_local_iterator();
|
||||
}
|
||||
|
||||
const_local_iterator cbegin(size_type n) const
|
||||
{
|
||||
@ -616,7 +617,8 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
|
||||
unordered_multiset(unordered_multiset const&, allocator_type const&);
|
||||
|
||||
unordered_multiset(BOOST_RV_REF(unordered_multiset), allocator_type const&);
|
||||
unordered_multiset(
|
||||
BOOST_RV_REF(unordered_multiset), allocator_type const&);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
unordered_multiset(std::initializer_list<value_type>,
|
||||
@ -756,8 +758,7 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
{
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
table_.node_alloc(), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)))));
|
||||
}
|
||||
|
||||
@ -813,9 +814,9 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
hint,
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)))));
|
||||
}
|
||||
|
||||
@ -858,12 +859,11 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
} \
|
||||
\
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
iterator emplace_hint(const_iterator hint, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
iterator emplace_hint( \
|
||||
const_iterator hint, BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return iterator(table_.emplace_hint_equiv( \
|
||||
hint, \
|
||||
boost::unordered::detail::func::construct_node_from_args( \
|
||||
hint, boost::unordered::detail::func::construct_node_from_args( \
|
||||
table_.node_alloc(), \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))))); \
|
||||
@ -1019,7 +1019,10 @@ template <class T, class H, class P, class A> class unordered_multiset
|
||||
|
||||
local_iterator end(size_type) { return local_iterator(); }
|
||||
|
||||
const_local_iterator end(size_type) const { return const_local_iterator(); }
|
||||
const_local_iterator end(size_type) const
|
||||
{
|
||||
return const_local_iterator();
|
||||
}
|
||||
|
||||
const_local_iterator cbegin(size_type n) const
|
||||
{
|
||||
@ -1117,9 +1120,9 @@ unordered_set<T, H, P, A>::unordered_set(
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_set<T, H, P, A>::unordered_set(std::initializer_list<value_type> list,
|
||||
size_type n, const hasher& hf, const key_equal& eql,
|
||||
const allocator_type& a)
|
||||
unordered_set<T, H, P, A>::unordered_set(
|
||||
std::initializer_list<value_type> list, size_type n, const hasher& hf,
|
||||
const key_equal& eql, const allocator_type& a)
|
||||
: table_(
|
||||
boost::unordered::detail::initial_size(list.begin(), list.end(), n),
|
||||
hf, eql, a)
|
||||
@ -1130,7 +1133,8 @@ unordered_set<T, H, P, A>::unordered_set(std::initializer_list<value_type> list,
|
||||
#endif
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_set<T, H, P, A>::unordered_set(size_type n, const allocator_type& a)
|
||||
unordered_set<T, H, P, A>::unordered_set(
|
||||
size_type n, const allocator_type& a)
|
||||
: table_(n, hasher(), key_equal(), a)
|
||||
{
|
||||
}
|
||||
@ -1165,8 +1169,9 @@ unordered_set<T, H, P, A>::unordered_set(InputIt f, InputIt l, size_type n,
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_set<T, H, P, A>::unordered_set(std::initializer_list<value_type> list,
|
||||
size_type n, const allocator_type& a)
|
||||
unordered_set<T, H, P, A>::unordered_set(
|
||||
std::initializer_list<value_type> list, size_type n,
|
||||
const allocator_type& a)
|
||||
: table_(
|
||||
boost::unordered::detail::initial_size(list.begin(), list.end(), n),
|
||||
hasher(), key_equal(), a)
|
||||
@ -1175,8 +1180,9 @@ unordered_set<T, H, P, A>::unordered_set(std::initializer_list<value_type> list,
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
unordered_set<T, H, P, A>::unordered_set(std::initializer_list<value_type> list,
|
||||
size_type n, const hasher& hf, const allocator_type& a)
|
||||
unordered_set<T, H, P, A>::unordered_set(
|
||||
std::initializer_list<value_type> list, size_type n, const hasher& hf,
|
||||
const allocator_type& a)
|
||||
: table_(
|
||||
boost::unordered::detail::initial_size(list.begin(), list.end(), n),
|
||||
hf, key_equal(), a)
|
||||
@ -1232,15 +1238,16 @@ void unordered_set<T, H, P, A>::insert(InputIt first, InputIt last)
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
template <class T, class H, class P, class A>
|
||||
void unordered_set<T, H, P, A>::insert(std::initializer_list<value_type> list)
|
||||
void unordered_set<T, H, P, A>::insert(
|
||||
std::initializer_list<value_type> list)
|
||||
{
|
||||
this->insert(list.begin(), list.end());
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
typename unordered_set<T, H, P, A>::iterator unordered_set<T, H, P, A>::erase(
|
||||
const_iterator position)
|
||||
typename unordered_set<T, H, P, A>::iterator
|
||||
unordered_set<T, H, P, A>::erase(const_iterator position)
|
||||
{
|
||||
node_pointer node = table::get_node(position);
|
||||
BOOST_ASSERT(node);
|
||||
@ -1250,15 +1257,15 @@ typename unordered_set<T, H, P, A>::iterator unordered_set<T, H, P, A>::erase(
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
typename unordered_set<T, H, P, A>::size_type unordered_set<T, H, P, A>::erase(
|
||||
const key_type& k)
|
||||
typename unordered_set<T, H, P, A>::size_type
|
||||
unordered_set<T, H, P, A>::erase(const key_type& k)
|
||||
{
|
||||
return table_.erase_key_unique(k);
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
typename unordered_set<T, H, P, A>::iterator unordered_set<T, H, P, A>::erase(
|
||||
const_iterator first, const_iterator last)
|
||||
typename unordered_set<T, H, P, A>::iterator
|
||||
unordered_set<T, H, P, A>::erase(const_iterator first, const_iterator last)
|
||||
{
|
||||
node_pointer last_node = table::get_node(last);
|
||||
if (first == last)
|
||||
@ -1339,7 +1346,8 @@ unordered_set<T, H, P, A>::find(const key_type& k) const
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate>
|
||||
template <class CompatibleKey, class CompatibleHash,
|
||||
class CompatiblePredicate>
|
||||
typename unordered_set<T, H, P, A>::const_iterator
|
||||
unordered_set<T, H, P, A>::find(CompatibleKey const& k,
|
||||
CompatibleHash const& hash, CompatiblePredicate const& eq) const
|
||||
@ -1349,8 +1357,8 @@ unordered_set<T, H, P, A>::find(CompatibleKey const& k,
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
typename unordered_set<T, H, P, A>::size_type unordered_set<T, H, P, A>::count(
|
||||
const key_type& k) const
|
||||
typename unordered_set<T, H, P, A>::size_type
|
||||
unordered_set<T, H, P, A>::count(const key_type& k) const
|
||||
{
|
||||
return table_.find_node(k) ? 1 : 0;
|
||||
}
|
||||
@ -1428,7 +1436,8 @@ inline bool operator!=(
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
inline void swap(unordered_set<T, H, P, A>& m1, unordered_set<T, H, P, A>& m2)
|
||||
inline void swap(
|
||||
unordered_set<T, H, P, A>& m1, unordered_set<T, H, P, A>& m2)
|
||||
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)))
|
||||
{
|
||||
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
|
||||
@ -1655,7 +1664,8 @@ unordered_multiset<T, H, P, A>::erase(const key_type& k)
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
typename unordered_multiset<T, H, P, A>::iterator
|
||||
unordered_multiset<T, H, P, A>::erase(const_iterator first, const_iterator last)
|
||||
unordered_multiset<T, H, P, A>::erase(
|
||||
const_iterator first, const_iterator last)
|
||||
{
|
||||
node_pointer last_node = table::get_node(last);
|
||||
if (first == last)
|
||||
@ -1744,7 +1754,8 @@ unordered_multiset<T, H, P, A>::find(const key_type& k) const
|
||||
}
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate>
|
||||
template <class CompatibleKey, class CompatibleHash,
|
||||
class CompatiblePredicate>
|
||||
typename unordered_multiset<T, H, P, A>::const_iterator
|
||||
unordered_multiset<T, H, P, A>::find(CompatibleKey const& k,
|
||||
CompatibleHash const& hash, CompatiblePredicate const& eq) const
|
||||
@ -1887,7 +1898,8 @@ template <typename N, typename T, typename A> class node_handle_set
|
||||
}
|
||||
|
||||
public:
|
||||
BOOST_CONSTEXPR node_handle_set() BOOST_NOEXCEPT : ptr_(), has_alloc_(false)
|
||||
BOOST_CONSTEXPR node_handle_set() BOOST_NOEXCEPT : ptr_(),
|
||||
has_alloc_(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1966,9 +1978,9 @@ template <typename N, typename T, typename A> class node_handle_set
|
||||
} else if (!n.has_alloc_) {
|
||||
n.move_allocator(*this);
|
||||
} else {
|
||||
swap_impl(n, boost::unordered::detail::integral_constant<bool,
|
||||
value_allocator_traits::
|
||||
propagate_on_container_swap::value>());
|
||||
swap_impl(
|
||||
n, boost::unordered::detail::integral_constant<bool,
|
||||
value_allocator_traits::propagate_on_container_swap::value>());
|
||||
}
|
||||
boost::swap(ptr_, n.ptr_);
|
||||
}
|
||||
|
@ -29,7 +29,8 @@ template <class T, class H, class P, class A>
|
||||
inline bool operator!=(
|
||||
unordered_set<T, H, P, A> const&, unordered_set<T, H, P, A> const&);
|
||||
template <class T, class H, class P, class A>
|
||||
inline void swap(unordered_set<T, H, P, A>& m1, unordered_set<T, H, P, A>& m2)
|
||||
inline void swap(
|
||||
unordered_set<T, H, P, A>& m1, unordered_set<T, H, P, A>& m2)
|
||||
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)));
|
||||
|
||||
template <class T, class H = boost::hash<T>, class P = std::equal_to<T>,
|
||||
|
@ -158,8 +158,7 @@ template <class T> struct range_construct_test5 : public range<T>, objects
|
||||
|
||||
void run() const
|
||||
{
|
||||
T x(this->values.begin(), this->values.end(), 0, hash, equal_to,
|
||||
allocator);
|
||||
T x(this->values.begin(), this->values.end(), 0, hash, equal_to, allocator);
|
||||
|
||||
DISABLE_EXCEPTIONS;
|
||||
test::check_container(x, this->values);
|
||||
@ -192,8 +191,7 @@ template <class T> struct copy_range_construct_test : public range<T>, objects
|
||||
void run() const
|
||||
{
|
||||
T x(test::copy_iterator(this->values.begin()),
|
||||
test::copy_iterator(this->values.end()), 0, hash, equal_to,
|
||||
allocator);
|
||||
test::copy_iterator(this->values.end()), 0, hash, equal_to, allocator);
|
||||
|
||||
DISABLE_EXCEPTIONS;
|
||||
test::check_container(x, this->values);
|
||||
|
@ -32,8 +32,7 @@ template <class T> struct copy_test2 : public test::exception_base
|
||||
test::random_values<T> values;
|
||||
T x;
|
||||
|
||||
copy_test2()
|
||||
: values(5, test::limited_range), x(values.begin(), values.end())
|
||||
copy_test2() : values(5, test::limited_range), x(values.begin(), values.end())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,7 @@ void insert_exception_test_impl(T x, Inserter insert, Values const& v)
|
||||
try {
|
||||
ENABLE_EXCEPTIONS;
|
||||
|
||||
for (typename Values::const_iterator it = v.begin(); it != v.end();
|
||||
++it) {
|
||||
for (typename Values::const_iterator it = v.begin(); it != v.end(); ++it) {
|
||||
strong.store(x, test::detail::tracker.count_allocations);
|
||||
insert(x, it);
|
||||
}
|
||||
|
@ -121,8 +121,8 @@ template <class T> struct equivalent_test1 : move_assign_base<T>
|
||||
}
|
||||
};
|
||||
|
||||
EXCEPTION_TESTS((move_assign_test1)(move_assign_test2)(move_assign_test3)(
|
||||
move_assign_test4)(move_assign_test4a)(move_assign_test5)(
|
||||
equivalent_test1),
|
||||
EXCEPTION_TESTS(
|
||||
(move_assign_test1)(move_assign_test2)(move_assign_test3)(move_assign_test4)(
|
||||
move_assign_test4a)(move_assign_test5)(equivalent_test1),
|
||||
CONTAINER_SEQ)
|
||||
RUN_TESTS()
|
||||
|
@ -18,9 +18,7 @@ test::seed_t initialize_seed(9387);
|
||||
template <class T> struct self_swap_base : public test::exception_base
|
||||
{
|
||||
test::random_values<T> values;
|
||||
self_swap_base(std::size_t count = 0) : values(count, test::limited_range)
|
||||
{
|
||||
}
|
||||
self_swap_base(std::size_t count = 0) : values(count, test::limited_range) {}
|
||||
|
||||
typedef T data_type;
|
||||
T init() const { return T(values.begin(), values.end()); }
|
||||
@ -71,11 +69,10 @@ template <class T> struct swap_base : public test::exception_base
|
||||
y_values(count2, test::limited_range),
|
||||
initial_x(x_values.begin(), x_values.end(), 0, hasher(tag1),
|
||||
key_equal(tag1), allocator_type(tag1)),
|
||||
initial_y(
|
||||
y_values.begin(), y_values.end(), 0, hasher(tag2),
|
||||
initial_y(y_values.begin(), y_values.end(), 0, hasher(tag2),
|
||||
key_equal(tag2),
|
||||
allocator_type(
|
||||
T::allocator_type::propagate_on_container_swap::value ? tag2
|
||||
allocator_type(T::allocator_type::propagate_on_container_swap::value
|
||||
? tag2
|
||||
: tag1))
|
||||
{
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ bool equivalent_impl(T1 const& x, T2 const& y, base_type)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool equivalent_impl(boost::hash<T> const&, boost::hash<T> const&, derived_type)
|
||||
bool equivalent_impl(
|
||||
boost::hash<T> const&, boost::hash<T> const&, derived_type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -36,12 +36,10 @@
|
||||
#define UNORDERED_EXCEPTION_TEST_POSTFIX RUN_TESTS()
|
||||
|
||||
#define EXCEPTION_TESTS(test_seq, param_seq) \
|
||||
BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
|
||||
EXCEPTION_TESTS_OP, (test_seq)((1))(param_seq))
|
||||
BOOST_PP_SEQ_FOR_EACH_PRODUCT(EXCEPTION_TESTS_OP, (test_seq)((1))(param_seq))
|
||||
|
||||
#define EXCEPTION_TESTS_REPEAT(n, test_seq, param_seq) \
|
||||
BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
|
||||
EXCEPTION_TESTS_OP, (test_seq)((n))(param_seq))
|
||||
BOOST_PP_SEQ_FOR_EACH_PRODUCT(EXCEPTION_TESTS_OP, (test_seq)((n))(param_seq))
|
||||
|
||||
#define EXCEPTION_TESTS_OP(r, product) \
|
||||
UNORDERED_EXCEPTION_TEST_CASE_REPEAT( \
|
||||
@ -51,8 +49,7 @@
|
||||
BOOST_PP_SEQ_ELEM(2, product))
|
||||
|
||||
#define UNORDERED_SCOPE(scope_name) \
|
||||
for (::test::scope_guard unordered_test_guard( \
|
||||
BOOST_STRINGIZE(scope_name)); \
|
||||
for (::test::scope_guard unordered_test_guard(BOOST_STRINGIZE(scope_name)); \
|
||||
!unordered_test_guard.dismissed(); unordered_test_guard.dismiss())
|
||||
|
||||
#define UNORDERED_EPOINT(name) \
|
||||
@ -235,7 +232,8 @@ void epoint(char const* name)
|
||||
}
|
||||
}
|
||||
|
||||
template <class Test> void exception_safety(Test const& f, char const* /*name*/)
|
||||
template <class Test>
|
||||
void exception_safety(Test const& f, char const* /*name*/)
|
||||
{
|
||||
test_runner<Test> runner(f);
|
||||
|
||||
@ -319,7 +317,10 @@ struct exception_looper
|
||||
}
|
||||
}
|
||||
|
||||
void unexpected_exception_caught() { error_msg = "Unexpected exception."; }
|
||||
void unexpected_exception_caught()
|
||||
{
|
||||
error_msg = "Unexpected exception.";
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
|
@ -69,8 +69,7 @@ inline std::string generate(std::string const*, random_generator g)
|
||||
|
||||
char const* strings[] = {"'vZh(3~ms", "%m", "_Y%U", "N'Y", "4,J_J"};
|
||||
for (std::size_t i = 0; i < length; ++i) {
|
||||
result +=
|
||||
strings[random_value(sizeof(strings) / sizeof(strings[0]))];
|
||||
result += strings[random_value(sizeof(strings) / sizeof(strings[0]))];
|
||||
}
|
||||
} else {
|
||||
std::size_t length = test::random_value(10) + 1;
|
||||
|
@ -71,8 +71,7 @@ template <class X> void check_equivalent_keys(X const& x1)
|
||||
|
||||
if (lit == lend) {
|
||||
BOOST_ERROR("Unable to find element with a local_iterator");
|
||||
std::cerr << "Checked: " << count_checked << " elements"
|
||||
<< std::endl;
|
||||
std::cerr << "Checked: " << count_checked << " elements" << std::endl;
|
||||
} else {
|
||||
unsigned int count2 = 0;
|
||||
for (; lit != lend && eq(get_key<X>(*lit), key); ++lit)
|
||||
@ -98,8 +97,7 @@ template <class X> void check_equivalent_keys(X const& x1)
|
||||
|
||||
// Check the load factor.
|
||||
|
||||
float load_factor =
|
||||
size == 0 ? 0 : static_cast<float>(size) /
|
||||
float load_factor = size == 0 ? 0 : static_cast<float>(size) /
|
||||
static_cast<float>(x1.bucket_count());
|
||||
using namespace std;
|
||||
if (fabs(x1.load_factor() - load_factor) > x1.load_factor() / 64)
|
||||
@ -111,8 +109,7 @@ template <class X> void check_equivalent_keys(X const& x1)
|
||||
|
||||
for (BOOST_DEDUCED_TYPENAME X::size_type i = 0; i < x1.bucket_count();
|
||||
++i) {
|
||||
for (BOOST_DEDUCED_TYPENAME X::const_local_iterator
|
||||
begin2 = x1.begin(i),
|
||||
for (BOOST_DEDUCED_TYPENAME X::const_local_iterator begin2 = x1.begin(i),
|
||||
end2 = x1.end(i);
|
||||
begin2 != end2; ++begin2) {
|
||||
++bucket_size;
|
||||
|
@ -114,8 +114,8 @@ class list_iterator
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class list_const_iterator : public std::iterator<std::forward_iterator_tag, T,
|
||||
int, T const*, T const&>
|
||||
class list_const_iterator : public std::iterator<std::forward_iterator_tag,
|
||||
T, int, T const*, T const&>
|
||||
{
|
||||
friend class list_iterator<T>;
|
||||
friend class test::list<T>;
|
||||
@ -267,8 +267,7 @@ template <typename T> class list
|
||||
{
|
||||
node** ptr = &(*l)->next_;
|
||||
for (size_type count = 0; count < recurse_limit && *ptr; ++count) {
|
||||
ptr = merge_adjacent_ranges(
|
||||
l, ptr, merge_sort(ptr, count, less), less);
|
||||
ptr = merge_adjacent_ranges(l, ptr, merge_sort(ptr, count, less), less);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ template <class Container> struct has_unique_keys
|
||||
std::pair<BOOST_DEDUCED_TYPENAME Container::iterator, bool> const&);
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value = sizeof(long) ==
|
||||
sizeof(flip(
|
||||
((Container*)0)
|
||||
->insert(*(
|
||||
BOOST_DEDUCED_TYPENAME Container::value_type*)0))));
|
||||
sizeof(
|
||||
flip(((Container*)0)
|
||||
->insert(
|
||||
*(BOOST_DEDUCED_TYPENAME Container::value_type*)0))));
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,8 @@ template <class X> class strong
|
||||
|
||||
void test(X const& x, unsigned int allocations = 0) const
|
||||
{
|
||||
if (!(x.size() == values_.size() &&
|
||||
test::equal(
|
||||
x.cbegin(), x.cend(), values_.begin(), test::equivalent)))
|
||||
if (!(x.size() == values_.size() && test::equal(x.cbegin(), x.cend(),
|
||||
values_.begin(), test::equivalent)))
|
||||
BOOST_ERROR("Strong exception safety failure.");
|
||||
if (allocations != allocations_)
|
||||
BOOST_ERROR("Strong exception failure: extra allocations.");
|
||||
|
@ -87,8 +87,7 @@ struct state
|
||||
i->run();
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << std::flush;
|
||||
if (quiet && error_count != boost::detail::test_errors()) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Error in: " << i->name
|
||||
<< "\n"
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Error in: " << i->name << "\n"
|
||||
<< std::flush;
|
||||
}
|
||||
}
|
||||
@ -107,8 +106,7 @@ struct state
|
||||
int end_sub_test(char const* name, int value)
|
||||
{
|
||||
if (is_quiet && value != boost::detail::test_errors() + 1) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Error in sub-test: " << name
|
||||
<< "\n"
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Error in sub-test: " << name << "\n"
|
||||
<< std::flush;
|
||||
}
|
||||
return 0;
|
||||
@ -137,8 +135,8 @@ static inline state& get_state()
|
||||
<< "__cplusplus: " << BOOST_UNORDERED_CPLUSPLUS << "\n\n" \
|
||||
<< "BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT: " \
|
||||
<< BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT << "\n" \
|
||||
<< "BOOST_UNORDERED_EMPLACE_LIMIT: " \
|
||||
<< BOOST_UNORDERED_EMPLACE_LIMIT << "\n" \
|
||||
<< "BOOST_UNORDERED_EMPLACE_LIMIT: " << BOOST_UNORDERED_EMPLACE_LIMIT \
|
||||
<< "\n" \
|
||||
<< "BOOST_UNORDERED_USE_ALLOCATOR_TRAITS: " \
|
||||
<< BOOST_UNORDERED_USE_ALLOCATOR_TRAITS << "\n" \
|
||||
<< "BOOST_UNORDERED_CXX11_CONSTRUCTION: " \
|
||||
|
@ -64,7 +64,8 @@ class object : private counted_object
|
||||
}
|
||||
}
|
||||
|
||||
object(object const& x) : counted_object(x), tag1_(x.tag1_), tag2_(x.tag2_)
|
||||
object(object const& x)
|
||||
: counted_object(x), tag1_(x.tag1_), tag2_(x.tag2_)
|
||||
{
|
||||
UNORDERED_SCOPE(object::object(object))
|
||||
{
|
||||
@ -467,8 +468,7 @@ template <class T> class allocator
|
||||
{
|
||||
//::operator delete((void*) p);
|
||||
if (p) {
|
||||
test::detail::tracker.track_deallocate(
|
||||
(void*)p, n, sizeof(T), tag_);
|
||||
test::detail::tracker.track_deallocate((void*)p, n, sizeof(T), tag_);
|
||||
using namespace std;
|
||||
free(p);
|
||||
}
|
||||
@ -647,8 +647,7 @@ template <class T> class allocator2
|
||||
{
|
||||
//::operator delete((void*) p);
|
||||
if (p) {
|
||||
test::detail::tracker.track_deallocate(
|
||||
(void*)p, n, sizeof(T), tag_);
|
||||
test::detail::tracker.track_deallocate((void*)p, n, sizeof(T), tag_);
|
||||
using namespace std;
|
||||
free(p);
|
||||
}
|
||||
|
@ -303,7 +303,10 @@ template <class T> class ptr
|
||||
return tmp;
|
||||
}
|
||||
ptr operator+(std::ptrdiff_t s) const { return ptr<T>(ptr_ + s); }
|
||||
friend ptr operator+(std::ptrdiff_t s, ptr p) { return ptr<T>(s + p.ptr_); }
|
||||
friend ptr operator+(std::ptrdiff_t s, ptr p)
|
||||
{
|
||||
return ptr<T>(s + p.ptr_);
|
||||
}
|
||||
T& operator[](std::ptrdiff_t s) const { return ptr_[s]; }
|
||||
bool operator!() const { return !ptr_; }
|
||||
|
||||
@ -351,7 +354,10 @@ template <class T> class const_ptr
|
||||
++ptr_;
|
||||
return tmp;
|
||||
}
|
||||
const_ptr operator+(std::ptrdiff_t s) const { return const_ptr(ptr_ + s); }
|
||||
const_ptr operator+(std::ptrdiff_t s) const
|
||||
{
|
||||
return const_ptr(ptr_ + s);
|
||||
}
|
||||
friend const_ptr operator+(std::ptrdiff_t s, const_ptr p)
|
||||
{
|
||||
return ptr<T>(s + p.ptr_);
|
||||
@ -410,7 +416,10 @@ template <class T> class allocator
|
||||
return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
|
||||
}
|
||||
|
||||
void deallocate(pointer p, size_type) { ::operator delete((void*)p.ptr_); }
|
||||
void deallocate(pointer p, size_type)
|
||||
{
|
||||
::operator delete((void*)p.ptr_);
|
||||
}
|
||||
|
||||
void construct(T* p, T const& t) { new ((void*)p) T(t); }
|
||||
|
||||
@ -477,7 +486,10 @@ template <class T> class allocator<T const>
|
||||
return pointer(static_cast<T const*>(::operator new(n * sizeof(T))));
|
||||
}
|
||||
|
||||
void deallocate(pointer p, size_type) { ::operator delete((void*)p.ptr_); }
|
||||
void deallocate(pointer p, size_type)
|
||||
{
|
||||
::operator delete((void*)p.ptr_);
|
||||
}
|
||||
|
||||
void construct(T const* p, T const& t) { new ((void*)p) T(t); }
|
||||
|
||||
|
@ -115,8 +115,7 @@ void test_empty_allocator()
|
||||
BOOST_STATIC_ASSERT((boost::is_same<traits::size_type,
|
||||
std::make_unsigned<std::ptrdiff_t>::type>::value));
|
||||
#else
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<traits::size_type, std::size_t>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<traits::size_type, std::size_t>::value));
|
||||
#endif
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<traits::difference_type, std::ptrdiff_t>::value));
|
||||
@ -156,8 +155,7 @@ void test_allocator1()
|
||||
BOOST_STATIC_ASSERT((boost::is_same<traits::size_type,
|
||||
std::make_unsigned<std::ptrdiff_t>::type>::value));
|
||||
#else
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<traits::size_type, std::size_t>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<traits::size_type, std::size_t>::value));
|
||||
#endif
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<traits::difference_type, std::ptrdiff_t>::value));
|
||||
@ -200,8 +198,7 @@ void test_allocator2()
|
||||
{
|
||||
typedef allocator2<int> allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<allocator> traits;
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<traits::size_type, std::size_t>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<traits::size_type, std::size_t>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<traits::difference_type, std::ptrdiff_t>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<traits::pointer, int*>::value));
|
||||
|
@ -51,8 +51,7 @@ template <class X> void tests(X*, test::random_generator generator)
|
||||
if (bucket < x.bucket_count()) {
|
||||
// lit? lend?? I need a new naming scheme.
|
||||
const_local_iterator lit = x.begin(bucket), lend = x.end(bucket);
|
||||
while (lit != lend &&
|
||||
test::get_key<X>(*it) != test::get_key<X>(*lit)) {
|
||||
while (lit != lend && test::get_key<X>(*it) != test::get_key<X>(*lit)) {
|
||||
++lit;
|
||||
}
|
||||
BOOST_TEST(lit != lend);
|
||||
@ -62,8 +61,8 @@ template <class X> void tests(X*, test::random_generator generator)
|
||||
for (size_type i = 0; i < x.bucket_count(); ++i) {
|
||||
BOOST_TEST(x.bucket_size(i) ==
|
||||
static_cast<size_type>(std::distance(x.begin(i), x.end(i))));
|
||||
BOOST_TEST(x.bucket_size(i) == static_cast<size_type>(std::distance(
|
||||
x.cbegin(i), x.cend(i))));
|
||||
BOOST_TEST(x.bucket_size(i) ==
|
||||
static_cast<size_type>(std::distance(x.cbegin(i), x.cend(i))));
|
||||
X const& x_ref = x;
|
||||
BOOST_TEST(x.bucket_size(i) == static_cast<size_type>(std::distance(
|
||||
x_ref.begin(i), x_ref.end(i))));
|
||||
@ -88,9 +87,9 @@ using test::default_generator;
|
||||
using test::generate_collisions;
|
||||
using test::limited_range;
|
||||
|
||||
UNORDERED_TEST(tests, ((test_multimap_std_alloc)(test_set)(test_multiset)(
|
||||
test_map)(test_multimap))((default_generator)(
|
||||
generate_collisions)(limited_range)))
|
||||
UNORDERED_TEST(tests,
|
||||
((test_multimap_std_alloc)(test_set)(test_multiset)(test_map)(
|
||||
test_multimap))((default_generator)(generate_collisions)(limited_range)))
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -26,8 +26,8 @@ INSTANTIATE(map)<int, int, boost::hash<int>, std::equal_to<int>,
|
||||
INSTANTIATE(multimap)<int const, int const, boost::hash<int>,
|
||||
std::equal_to<int>, test::minimal::allocator<int> >;
|
||||
|
||||
INSTANTIATE(map)<test::minimal::assignable const,
|
||||
test::minimal::default_assignable const,
|
||||
INSTANTIATE(
|
||||
map)<test::minimal::assignable const, test::minimal::default_assignable const,
|
||||
test::minimal::hash<test::minimal::assignable>,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<int> >;
|
||||
@ -40,8 +40,7 @@ UNORDERED_AUTO_TEST(test0)
|
||||
{
|
||||
test::minimal::constructor_param x;
|
||||
|
||||
typedef std::pair<test::minimal::assignable const,
|
||||
test::minimal::assignable>
|
||||
typedef std::pair<test::minimal::assignable const, test::minimal::assignable>
|
||||
value_type;
|
||||
value_type value(x, x);
|
||||
|
||||
@ -72,8 +71,7 @@ UNORDERED_AUTO_TEST(test0)
|
||||
int_multimap2;
|
||||
|
||||
boost::unordered_multimap<test::minimal::assignable,
|
||||
test::minimal::assignable,
|
||||
test::minimal::hash<test::minimal::assignable>,
|
||||
test::minimal::assignable, test::minimal::hash<test::minimal::assignable>,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<value_type> >
|
||||
multimap;
|
||||
@ -85,8 +83,7 @@ UNORDERED_AUTO_TEST(test0)
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_tests)
|
||||
{
|
||||
typedef std::pair<
|
||||
test::minimal::copy_constructible_equality_comparable const,
|
||||
typedef std::pair<test::minimal::copy_constructible_equality_comparable const,
|
||||
test::minimal::copy_constructible_equality_comparable>
|
||||
value_type;
|
||||
|
||||
@ -96,11 +93,9 @@ UNORDERED_AUTO_TEST(equality_tests)
|
||||
test::minimal::cxx11_allocator<std::pair<int const, int> > >
|
||||
int_map2;
|
||||
|
||||
boost::unordered_map<
|
||||
boost::unordered_map<test::minimal::copy_constructible_equality_comparable,
|
||||
test::minimal::copy_constructible_equality_comparable,
|
||||
test::minimal::copy_constructible_equality_comparable,
|
||||
test::minimal::hash<
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::hash<test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::equal_to<
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::allocator<value_type> >
|
||||
@ -119,8 +114,7 @@ UNORDERED_AUTO_TEST(equality_tests)
|
||||
boost::unordered_multimap<
|
||||
test::minimal::copy_constructible_equality_comparable,
|
||||
test::minimal::copy_constructible_equality_comparable,
|
||||
test::minimal::hash<
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::hash<test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::equal_to<
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::allocator<value_type> >
|
||||
@ -182,8 +176,7 @@ UNORDERED_AUTO_TEST(test2)
|
||||
test::minimal::hash<test::minimal::assignable> hash(x);
|
||||
test::minimal::equal_to<test::minimal::assignable> equal_to(x);
|
||||
|
||||
typedef std::pair<test::minimal::assignable const,
|
||||
test::minimal::assignable>
|
||||
typedef std::pair<test::minimal::assignable const, test::minimal::assignable>
|
||||
map_value_type;
|
||||
map_value_type map_value(assignable, assignable);
|
||||
|
||||
@ -214,8 +207,7 @@ UNORDERED_AUTO_TEST(test2)
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Test unordered_multimap.\n";
|
||||
|
||||
boost::unordered_multimap<test::minimal::assignable,
|
||||
test::minimal::assignable,
|
||||
test::minimal::hash<test::minimal::assignable>,
|
||||
test::minimal::assignable, test::minimal::hash<test::minimal::assignable>,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<map_value_type> >
|
||||
multimap;
|
||||
|
@ -88,10 +88,8 @@ UNORDERED_AUTO_TEST(equality_tests)
|
||||
test::minimal::cxx11_allocator<int> >
|
||||
int_set2;
|
||||
|
||||
boost::unordered_set<
|
||||
test::minimal::copy_constructible_equality_comparable,
|
||||
test::minimal::hash<
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
boost::unordered_set<test::minimal::copy_constructible_equality_comparable,
|
||||
test::minimal::hash<test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::equal_to<
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::allocator<value_type> >
|
||||
@ -109,8 +107,7 @@ UNORDERED_AUTO_TEST(equality_tests)
|
||||
|
||||
boost::unordered_multiset<
|
||||
test::minimal::copy_constructible_equality_comparable,
|
||||
test::minimal::hash<
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::hash<test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::equal_to<
|
||||
test::minimal::copy_constructible_equality_comparable>,
|
||||
test::minimal::allocator<value_type> >
|
||||
|
@ -87,8 +87,7 @@ template <class X, class T> void container_test(X& r, T const&)
|
||||
|
||||
boost::function_requires<boost::InputIteratorConcept<iterator> >();
|
||||
BOOST_STATIC_ASSERT((boost::is_same<T, iterator_value_type>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_convertible<iterator, const_iterator>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<iterator, const_iterator>::value));
|
||||
|
||||
// const_iterator
|
||||
|
||||
@ -106,8 +105,8 @@ template <class X, class T> void container_test(X& r, T const&)
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<difference_type>::is_integer);
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<difference_type, iterator_difference_type>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<difference_type,
|
||||
const_iterator_difference_type>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<difference_type, const_iterator_difference_type>::value));
|
||||
|
||||
// size_type
|
||||
|
||||
@ -279,8 +278,8 @@ template <class X, class Key> void unordered_set_test(X& r, Key const&)
|
||||
(boost::is_same<value_type const*, const_iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<value_type const*, local_iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<value_type const*,
|
||||
const_local_iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<value_type const*, const_local_iterator_pointer>::value));
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME X::node_type node_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME node_type::value_type node_value_type;
|
||||
@ -324,8 +323,8 @@ void unordered_map_test(X& r, Key const& k, T const& v)
|
||||
(boost::is_same<value_type const*, const_iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<value_type*, local_iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<value_type const*,
|
||||
const_local_iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<value_type const*, const_local_iterator_pointer>::value));
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME X::node_type node_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME node_type::key_type node_key_type;
|
||||
@ -480,8 +479,8 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
|
||||
typedef BOOST_DEDUCED_TYPENAME X::local_iterator local_iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME X::const_local_iterator const_local_iterator;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
boost::BOOST_ITERATOR_CATEGORY<iterator>::type iterator_category;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::BOOST_ITERATOR_CATEGORY<iterator>::type
|
||||
iterator_category;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_difference<iterator>::type
|
||||
iterator_difference;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_pointer<iterator>::type
|
||||
@ -491,21 +490,21 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::BOOST_ITERATOR_CATEGORY<
|
||||
local_iterator>::type local_iterator_category;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_difference<
|
||||
local_iterator>::type local_iterator_difference;
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
boost::iterator_difference<local_iterator>::type local_iterator_difference;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_pointer<local_iterator>::type
|
||||
local_iterator_pointer;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference<
|
||||
local_iterator>::type local_iterator_reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference<local_iterator>::type
|
||||
local_iterator_reference;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::BOOST_ITERATOR_CATEGORY<
|
||||
const_iterator>::type const_iterator_category;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_difference<
|
||||
const_iterator>::type const_iterator_difference;
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
boost::iterator_difference<const_iterator>::type const_iterator_difference;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_pointer<const_iterator>::type
|
||||
const_iterator_pointer;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference<
|
||||
const_iterator>::type const_iterator_reference;
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference<const_iterator>::type
|
||||
const_iterator_reference;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::BOOST_ITERATOR_CATEGORY<
|
||||
const_local_iterator>::type const_local_iterator_category;
|
||||
@ -530,8 +529,8 @@ void unordered_test(X& x, Key& k, Hash& hf, Pred& eq)
|
||||
boost::function_requires<boost::InputIteratorConcept<local_iterator> >();
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<local_iterator_category, iterator_category>::value));
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<local_iterator_difference, iterator_difference>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<local_iterator_difference, iterator_difference>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<local_iterator_pointer, iterator_pointer>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
@ -794,8 +793,7 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
|
||||
T v2(v);
|
||||
a.insert(boost::move(v2));
|
||||
T v3(v);
|
||||
test::check_return_type<iterator>::equals(
|
||||
a.emplace_hint(q, boost::move(v3)));
|
||||
test::check_return_type<iterator>::equals(a.emplace_hint(q, boost::move(v3)));
|
||||
T v4(v);
|
||||
test::check_return_type<iterator>::equals(a.insert(q, boost::move(v4)));
|
||||
|
||||
|
@ -22,7 +22,8 @@ namespace constructor_tests {
|
||||
|
||||
test::seed_t initialize_seed(356730);
|
||||
|
||||
template <class T> void constructor_tests1(T*, test::random_generator generator)
|
||||
template <class T>
|
||||
void constructor_tests1(T*, test::random_generator generator)
|
||||
{
|
||||
BOOST_DEDUCED_TYPENAME T::hasher hf;
|
||||
BOOST_DEDUCED_TYPENAME T::key_equal eq;
|
||||
@ -273,9 +274,10 @@ void constructor_tests2(T*, test::random_generator const& generator)
|
||||
{
|
||||
test::check_instances check_;
|
||||
test::random_values<T> v(100, generator);
|
||||
BOOST_DEDUCED_TYPENAME test::random_values<T>::const_iterator
|
||||
v_begin = v.begin(),
|
||||
v_end = v.end();
|
||||
BOOST_DEDUCED_TYPENAME test::random_values<T>::const_iterator v_begin =
|
||||
v.begin(),
|
||||
v_end =
|
||||
v.end();
|
||||
T x(test::input_iterator(v_begin), test::input_iterator(v_end), 0, hf1,
|
||||
eq1);
|
||||
BOOST_DEDUCED_TYPENAME T::const_iterator x_begin = x.begin(),
|
||||
@ -292,10 +294,10 @@ void constructor_tests2(T*, test::random_generator const& generator)
|
||||
{
|
||||
test::check_instances check_;
|
||||
test::random_values<T> v(100, generator);
|
||||
T x(test::copy_iterator(v.begin()), test::copy_iterator(v.end()), 0,
|
||||
hf1, eq1);
|
||||
T y(test::copy_iterator(x.begin()), test::copy_iterator(x.end()), 0,
|
||||
hf2, eq2);
|
||||
T x(test::copy_iterator(v.begin()), test::copy_iterator(v.end()), 0, hf1,
|
||||
eq1);
|
||||
T y(test::copy_iterator(x.begin()), test::copy_iterator(x.end()), 0, hf2,
|
||||
eq2);
|
||||
test::check_container(x, v);
|
||||
test::check_container(y, x);
|
||||
test::check_equivalent_keys(x);
|
||||
|
@ -233,10 +233,10 @@ UNORDERED_AUTO_TEST(emplace_set)
|
||||
BOOST_TEST_EQ(check_.instances(), 8);
|
||||
BOOST_TEST_EQ(check_.constructions(), 9);
|
||||
|
||||
BOOST_TEST(r1.first ==
|
||||
x.emplace_hint(r1.first, 10, "", 'a', 4, 5, 6, 7, 8, 9, 10));
|
||||
BOOST_TEST(r1.first ==
|
||||
x.emplace_hint(r2.first, 10, "", 'a', 4, 5, 6, 7, 8, 9, 10));
|
||||
BOOST_TEST(
|
||||
r1.first == x.emplace_hint(r1.first, 10, "", 'a', 4, 5, 6, 7, 8, 9, 10));
|
||||
BOOST_TEST(
|
||||
r1.first == x.emplace_hint(r2.first, 10, "", 'a', 4, 5, 6, 7, 8, 9, 10));
|
||||
BOOST_TEST(
|
||||
r1.first == x.emplace_hint(x.end(), 10, "", 'a', 4, 5, 6, 7, 8, 9, 10));
|
||||
BOOST_TEST_EQ(check_.instances(), 8);
|
||||
|
@ -56,8 +56,7 @@ struct mod_compare
|
||||
|
||||
#define UNORDERED_EQUALITY_MULTIMAP_TEST(seq1, op, seq2) \
|
||||
{ \
|
||||
boost::unordered_multimap<int, int, mod_compare, mod_compare> map1, \
|
||||
map2; \
|
||||
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); \
|
||||
|
@ -30,8 +30,7 @@ struct write_pair_type
|
||||
template <class X1, class X2>
|
||||
void operator()(std::pair<X1, X2> const& x) const
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "(" << x.first << "," << x.second
|
||||
<< ")";
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "(" << x.first << "," << x.second << ")";
|
||||
}
|
||||
} write_pair;
|
||||
|
||||
@ -159,8 +158,7 @@ bool general_erase_range_test(Container& x, std::size_t start, std::size_t end)
|
||||
template <class Container> void erase_subrange_tests(Container const& x)
|
||||
{
|
||||
for (std::size_t length = 0; length < x.size(); ++length) {
|
||||
for (std::size_t position = 0; position < x.size() - length;
|
||||
++position) {
|
||||
for (std::size_t position = 0; position < x.size() - length; ++position) {
|
||||
Container y(x);
|
||||
collide_list init(y.begin(), y.end());
|
||||
if (!general_erase_range_test(y, position, position + length)) {
|
||||
|
@ -37,8 +37,8 @@ void erase_tests1(Container*, test::random_generator generator)
|
||||
test::random_values<Container> v(1000, generator);
|
||||
Container x(v.begin(), v.end());
|
||||
int iterations = 0;
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<Container>::iterator
|
||||
it = v.begin();
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<Container>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
std::size_t count = x.count(test::get_key<Container>(*it));
|
||||
std::size_t old_size = x.size();
|
||||
@ -99,12 +99,11 @@ void erase_tests1(Container*, test::random_generator generator)
|
||||
BOOST_TEST(next == x.erase(pos));
|
||||
--size;
|
||||
if (size > 0)
|
||||
BOOST_TEST(
|
||||
index == 0 ? next == x.begin() : next == test::next(prev));
|
||||
BOOST_TEST(index == 0 ? next == x.begin() : next == test::next(prev));
|
||||
BOOST_TEST(x.count(key) == count - 1);
|
||||
if (x.count(key) != count - 1) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << count << " => "
|
||||
<< x.count(key) << std::endl;
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << count << " => " << x.count(key)
|
||||
<< std::endl;
|
||||
}
|
||||
BOOST_TEST(x.size() == size);
|
||||
if (++iterations % 20 == 0)
|
||||
@ -158,15 +157,14 @@ void erase_tests1(Container*, test::random_generator generator)
|
||||
|
||||
while (iterators.size() > 1) {
|
||||
std::size_t start = test::random_value(iterators.size());
|
||||
std::size_t length =
|
||||
test::random_value(iterators.size() - start);
|
||||
std::size_t length = test::random_value(iterators.size() - start);
|
||||
x.erase(iterators[start], iterators[start + length]);
|
||||
iterators.erase(test::next(iterators.begin(), start),
|
||||
test::next(iterators.begin(), start + length));
|
||||
|
||||
BOOST_TEST(x.size() == iterators.size() - 1);
|
||||
BOOST_DEDUCED_TYPENAME std::vector<c_iterator>::const_iterator
|
||||
i2 = iterators.begin();
|
||||
BOOST_DEDUCED_TYPENAME std::vector<c_iterator>::const_iterator i2 =
|
||||
iterators.begin();
|
||||
for (c_iterator i1 = x.cbegin(); i1 != x.cend(); ++i1) {
|
||||
BOOST_TEST(i1 == *i2);
|
||||
++i2;
|
||||
@ -226,12 +224,11 @@ void erase_tests1(Container*, test::random_generator generator)
|
||||
x.quick_erase(pos);
|
||||
--size;
|
||||
if (size > 0)
|
||||
BOOST_TEST(
|
||||
index == 0 ? next == x.begin() : next == test::next(prev));
|
||||
BOOST_TEST(index == 0 ? next == x.begin() : next == test::next(prev));
|
||||
BOOST_TEST(x.count(key) == count - 1);
|
||||
if (x.count(key) != count - 1) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << count << " => "
|
||||
<< x.count(key) << std::endl;
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << count << " => " << x.count(key)
|
||||
<< std::endl;
|
||||
}
|
||||
BOOST_TEST(x.size() == size);
|
||||
if (++iterations % 20 == 0)
|
||||
|
@ -33,8 +33,8 @@ void extract_tests1(Container*, test::random_generator generator)
|
||||
test::random_values<Container> v(1000, generator);
|
||||
Container x(v.begin(), v.end());
|
||||
int iterations = 0;
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<Container>::iterator
|
||||
it = v.begin();
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<Container>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
std::size_t count = x.count(test::get_key<Container>(*it));
|
||||
std::size_t old_size = x.size();
|
||||
|
@ -37,22 +37,19 @@ template <class X> void find_tests1(X*, test::random_generator generator)
|
||||
tracker.begin();
|
||||
it1 != tracker.end(); ++it1) {
|
||||
BOOST_DEDUCED_TYPENAME X::key_type key = test::get_key<X>(*it1);
|
||||
BOOST_DEDUCED_TYPENAME X::const_iterator const_pos =
|
||||
x_const.find(key);
|
||||
BOOST_DEDUCED_TYPENAME X::const_iterator const_pos = x_const.find(key);
|
||||
iterator pos = x.find(key);
|
||||
BOOST_TEST(const_pos != x_const.end());
|
||||
BOOST_TEST(const_pos != x_const.end() &&
|
||||
x_const.key_eq()(key, test::get_key<X>(*const_pos)));
|
||||
BOOST_TEST(pos != x.end());
|
||||
BOOST_TEST(
|
||||
pos != x.end() && x.key_eq()(key, test::get_key<X>(*pos)));
|
||||
BOOST_TEST(pos != x.end() && x.key_eq()(key, test::get_key<X>(*pos)));
|
||||
|
||||
BOOST_TEST(x.count(key) == tracker.count(key));
|
||||
|
||||
test::compare_pairs(x.equal_range(key), tracker.equal_range(key),
|
||||
(BOOST_DEDUCED_TYPENAME X::value_type*)0);
|
||||
test::compare_pairs(x_const.equal_range(key),
|
||||
tracker.equal_range(key),
|
||||
test::compare_pairs(x_const.equal_range(key), tracker.equal_range(key),
|
||||
(BOOST_DEDUCED_TYPENAME X::value_type*)0);
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,7 @@ void unique_insert_tests1(X*, test::random_generator generator)
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
std::pair<iterator, bool> r1 = x.insert(*it);
|
||||
@ -76,8 +75,7 @@ void unique_insert_tests1(X*, test::random_generator generator)
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
typename X::value_type value = *it;
|
||||
@ -114,8 +112,7 @@ void equivalent_insert_tests1(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
BOOST_DEDUCED_TYPENAME X::iterator r1 = x.insert(*it);
|
||||
@ -144,13 +141,11 @@ void equivalent_insert_tests1(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
typename X::value_type value = *it;
|
||||
BOOST_DEDUCED_TYPENAME X::iterator r1 =
|
||||
x.insert(boost::move(value));
|
||||
BOOST_DEDUCED_TYPENAME X::iterator r1 = x.insert(boost::move(value));
|
||||
BOOST_DEDUCED_TYPENAME test::ordered<X>::iterator r2 =
|
||||
tracker.insert(*it);
|
||||
|
||||
@ -185,8 +180,7 @@ template <class X> void insert_tests2(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
iterator r1 = x.insert(x.begin(), *it);
|
||||
@ -215,8 +209,7 @@ template <class X> void insert_tests2(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
const_iterator r1 = x.insert(x_const.end(), *it);
|
||||
@ -245,8 +238,7 @@ template <class X> void insert_tests2(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
pos = x.insert(pos, *it);
|
||||
@ -275,8 +267,7 @@ template <class X> void insert_tests2(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
typename X::value_type value = *it;
|
||||
@ -305,8 +296,7 @@ template <class X> void insert_tests2(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
x.insert(it, test::next(it));
|
||||
@ -359,9 +349,10 @@ template <class X> void insert_tests2(X*, test::random_generator generator)
|
||||
X x;
|
||||
|
||||
test::random_values<X> v(1000, generator);
|
||||
BOOST_DEDUCED_TYPENAME test::random_values<X>::const_iterator
|
||||
begin = v.begin(),
|
||||
end = v.end();
|
||||
BOOST_DEDUCED_TYPENAME test::random_values<X>::const_iterator begin =
|
||||
v.begin(),
|
||||
end =
|
||||
v.end();
|
||||
x.insert(test::input_iterator(begin), test::input_iterator(end));
|
||||
test::check_container(x, v);
|
||||
|
||||
@ -389,10 +380,8 @@ template <class X> void insert_tests2(X*, test::random_generator generator)
|
||||
|
||||
test::random_values<X> v1(500, generator);
|
||||
test::random_values<X> v2(500, generator);
|
||||
x.insert(
|
||||
test::copy_iterator(v1.begin()), test::copy_iterator(v1.end()));
|
||||
x.insert(
|
||||
test::copy_iterator(v2.begin()), test::copy_iterator(v2.end()));
|
||||
x.insert(test::copy_iterator(v1.begin()), test::copy_iterator(v1.end()));
|
||||
x.insert(test::copy_iterator(v2.begin()), test::copy_iterator(v2.end()));
|
||||
|
||||
test::check_equivalent_keys(x);
|
||||
}
|
||||
@ -412,8 +401,7 @@ template <class X> void insert_tests2(X*, test::random_generator generator)
|
||||
x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator next =
|
||||
it;
|
||||
BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator next = it;
|
||||
for (std::size_t j = test::random_value(20); j > 0; ++j) {
|
||||
++next;
|
||||
if (next == v.end()) {
|
||||
@ -501,7 +489,8 @@ void equivalent_emplace_tests1(X*, test::random_generator generator)
|
||||
test::check_equivalent_keys(x);
|
||||
}
|
||||
|
||||
template <class X> void move_emplace_tests(X*, test::random_generator generator)
|
||||
template <class X>
|
||||
void move_emplace_tests(X*, test::random_generator generator)
|
||||
{
|
||||
X x;
|
||||
test::ordered<X> tracker = test::create_ordered(x);
|
||||
@ -603,12 +592,10 @@ template <class X> void map_tests2(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
std::pair<iterator, bool> r =
|
||||
x.insert_or_assign(it->first, it->second);
|
||||
std::pair<iterator, bool> r = x.insert_or_assign(it->first, it->second);
|
||||
BOOST_TEST(*r.first == *it);
|
||||
|
||||
tracker[it->first] = it->second;
|
||||
@ -634,8 +621,7 @@ template <class X> void map_tests2(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
iterator r = x.insert_or_assign(x.begin(), it->first, it->second);
|
||||
@ -664,8 +650,7 @@ template <class X> void map_tests2(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
iterator r = x.insert_or_assign(x.end(), it->first, it->second);
|
||||
@ -695,8 +680,7 @@ template <class X> void map_tests2(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
iterator r = x.insert_or_assign(last, it->first, it->second);
|
||||
@ -717,7 +701,8 @@ template <class X> void map_tests2(X*, test::random_generator generator)
|
||||
}
|
||||
}
|
||||
|
||||
template <class X> void try_emplace_tests(X*, test::random_generator generator)
|
||||
template <class X>
|
||||
void try_emplace_tests(X*, test::random_generator generator)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
|
||||
|
||||
@ -732,8 +717,7 @@ template <class X> void try_emplace_tests(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
iterator pos = x.find(it->first);
|
||||
@ -774,8 +758,7 @@ template <class X> void try_emplace_tests(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
iterator pos = x.find(it->first);
|
||||
@ -813,15 +796,13 @@ template <class X> void try_emplace_tests(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
iterator pos = x.find(it->first);
|
||||
bool found = pos != x.end();
|
||||
|
||||
typename X::iterator r =
|
||||
x.try_emplace(r.end(), it->first, it->second);
|
||||
typename X::iterator r = x.try_emplace(r.end(), it->first, it->second);
|
||||
if (found) {
|
||||
BOOST_TEST(pos == r);
|
||||
}
|
||||
@ -852,8 +833,7 @@ template <class X> void try_emplace_tests(X*, test::random_generator generator)
|
||||
for (BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator it =
|
||||
v.begin();
|
||||
it != v.end(); ++it) {
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count =
|
||||
x.bucket_count();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type old_bucket_count = x.bucket_count();
|
||||
float b = x.max_load_factor();
|
||||
|
||||
iterator pos = x.find(it->first);
|
||||
@ -943,10 +923,9 @@ UNORDERED_TEST(equivalent_insert_tests1,
|
||||
((test_multimap_std_alloc)(test_multiset)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(
|
||||
insert_tests2, ((test_multimap_std_alloc)(test_set)(test_multiset)(
|
||||
test_map)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
UNORDERED_TEST(insert_tests2,
|
||||
((test_multimap_std_alloc)(test_set)(test_multiset)(test_map)(
|
||||
test_multimap))((default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(unique_emplace_tests1,
|
||||
((test_set_std_alloc)(test_set)(test_map))(
|
||||
@ -1110,17 +1089,17 @@ UNORDERED_AUTO_TEST(map_emplace_test)
|
||||
|
||||
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
|
||||
x.emplace();
|
||||
BOOST_TEST(x.find(0) != x.end() &&
|
||||
x.find(0)->second == overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(0) != x.end() && x.find(0)->second == overloaded_constructor());
|
||||
#endif
|
||||
|
||||
x.emplace(2, 3);
|
||||
BOOST_TEST(x.find(2) != x.end() &&
|
||||
x.find(2)->second == overloaded_constructor(3));
|
||||
BOOST_TEST(
|
||||
x.find(2) != x.end() && x.find(2)->second == overloaded_constructor(3));
|
||||
|
||||
x.try_emplace(5);
|
||||
BOOST_TEST(x.find(5) != x.end() &&
|
||||
x.find(5)->second == overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(5) != x.end() && x.find(5)->second == overloaded_constructor());
|
||||
}
|
||||
|
||||
{
|
||||
@ -1131,13 +1110,13 @@ UNORDERED_AUTO_TEST(map_emplace_test)
|
||||
|
||||
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
|
||||
x.emplace();
|
||||
BOOST_TEST(x.find(0) != x.end() &&
|
||||
x.find(0)->second == overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(0) != x.end() && x.find(0)->second == overloaded_constructor());
|
||||
#endif
|
||||
|
||||
x.emplace(2, 3);
|
||||
BOOST_TEST(x.find(2) != x.end() &&
|
||||
x.find(2)->second == overloaded_constructor(3));
|
||||
BOOST_TEST(
|
||||
x.find(2) != x.end() && x.find(2)->second == overloaded_constructor(3));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1206,15 +1185,15 @@ UNORDERED_AUTO_TEST(map_emplace_test2)
|
||||
|
||||
x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(),
|
||||
boost::make_tuple());
|
||||
BOOST_TEST(x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second == overloaded_constructor());
|
||||
|
||||
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(
|
||||
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(piecewise_rvalue(), boost::make_tuple(2, 3),
|
||||
boost::make_tuple(4, 5, 6));
|
||||
@ -1231,14 +1210,14 @@ UNORDERED_AUTO_TEST(map_emplace_test2)
|
||||
x.clear();
|
||||
|
||||
x.try_emplace(overloaded_constructor());
|
||||
BOOST_TEST(x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second == overloaded_constructor());
|
||||
|
||||
x.try_emplace(1);
|
||||
BOOST_TEST(x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second == overloaded_constructor());
|
||||
|
||||
x.try_emplace(overloaded_constructor(2, 3), 4, 5, 6);
|
||||
BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() &&
|
||||
@ -1248,14 +1227,14 @@ UNORDERED_AUTO_TEST(map_emplace_test2)
|
||||
x.clear();
|
||||
|
||||
x.try_emplace(x.begin(), overloaded_constructor());
|
||||
BOOST_TEST(x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second == overloaded_constructor());
|
||||
|
||||
x.try_emplace(x.end(), 1);
|
||||
BOOST_TEST(x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second == overloaded_constructor());
|
||||
|
||||
x.try_emplace(x.begin(), overloaded_constructor(2, 3), 4, 5, 6);
|
||||
BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() &&
|
||||
@ -1264,8 +1243,8 @@ UNORDERED_AUTO_TEST(map_emplace_test2)
|
||||
}
|
||||
|
||||
{
|
||||
boost::unordered_multimap<overloaded_constructor,
|
||||
overloaded_constructor, boost::hash<overloaded_constructor>,
|
||||
boost::unordered_multimap<overloaded_constructor, overloaded_constructor,
|
||||
boost::hash<overloaded_constructor>,
|
||||
std::equal_to<overloaded_constructor>,
|
||||
test::allocator1<std::pair<overloaded_constructor const,
|
||||
overloaded_constructor> > >
|
||||
@ -1273,15 +1252,15 @@ UNORDERED_AUTO_TEST(map_emplace_test2)
|
||||
|
||||
x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(),
|
||||
boost::make_tuple());
|
||||
BOOST_TEST(x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second == overloaded_constructor());
|
||||
|
||||
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(
|
||||
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(piecewise_rvalue(), boost::make_tuple(2, 3),
|
||||
boost::make_tuple(4, 5, 6));
|
||||
@ -1377,15 +1356,15 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
|
||||
x.emplace(PIECEWISE_NAMESPACE::piecewise_construct,
|
||||
TUPLE_NAMESPACE::make_tuple(), TUPLE_NAMESPACE::make_tuple());
|
||||
BOOST_TEST(x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second == overloaded_constructor());
|
||||
|
||||
x.emplace(convertible_to_piecewise(), TUPLE_NAMESPACE::make_tuple(1),
|
||||
TUPLE_NAMESPACE::make_tuple());
|
||||
BOOST_TEST(x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second == overloaded_constructor());
|
||||
|
||||
x.emplace(piecewise_rvalue(), TUPLE_NAMESPACE::make_tuple(2, 3),
|
||||
TUPLE_NAMESPACE::make_tuple(4, 5, 6));
|
||||
@ -1394,8 +1373,8 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
overloaded_constructor(4, 5, 6));
|
||||
|
||||
derived_from_piecewise_construct_t d;
|
||||
x.emplace(d, TUPLE_NAMESPACE::make_tuple(9, 3, 1),
|
||||
TUPLE_NAMESPACE::make_tuple(10));
|
||||
x.emplace(
|
||||
d, TUPLE_NAMESPACE::make_tuple(9, 3, 1), TUPLE_NAMESPACE::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));
|
||||
@ -1403,14 +1382,14 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
x.clear();
|
||||
|
||||
x.try_emplace(overloaded_constructor());
|
||||
BOOST_TEST(x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second == overloaded_constructor());
|
||||
|
||||
x.try_emplace(1);
|
||||
BOOST_TEST(x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second == overloaded_constructor());
|
||||
|
||||
x.try_emplace(overloaded_constructor(2, 3), 4, 5, 6);
|
||||
BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() &&
|
||||
@ -1418,8 +1397,8 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
overloaded_constructor(4, 5, 6));
|
||||
}
|
||||
{
|
||||
boost::unordered_multimap<overloaded_constructor,
|
||||
overloaded_constructor, boost::hash<overloaded_constructor>,
|
||||
boost::unordered_multimap<overloaded_constructor, overloaded_constructor,
|
||||
boost::hash<overloaded_constructor>,
|
||||
std::equal_to<overloaded_constructor>,
|
||||
test::allocator1<std::pair<overloaded_constructor const,
|
||||
overloaded_constructor> > >
|
||||
@ -1427,15 +1406,15 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
|
||||
x.emplace(PIECEWISE_NAMESPACE::piecewise_construct,
|
||||
TUPLE_NAMESPACE::make_tuple(), TUPLE_NAMESPACE::make_tuple());
|
||||
BOOST_TEST(x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor()) != x.end() &&
|
||||
x.find(overloaded_constructor())->second == overloaded_constructor());
|
||||
|
||||
x.emplace(convertible_to_piecewise(), TUPLE_NAMESPACE::make_tuple(1),
|
||||
TUPLE_NAMESPACE::make_tuple());
|
||||
BOOST_TEST(x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second ==
|
||||
overloaded_constructor());
|
||||
BOOST_TEST(
|
||||
x.find(overloaded_constructor(1)) != x.end() &&
|
||||
x.find(overloaded_constructor(1))->second == overloaded_constructor());
|
||||
|
||||
x.emplace(piecewise_rvalue(), TUPLE_NAMESPACE::make_tuple(2, 3),
|
||||
TUPLE_NAMESPACE::make_tuple(4, 5, 6));
|
||||
@ -1444,8 +1423,8 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
overloaded_constructor(4, 5, 6));
|
||||
|
||||
derived_from_piecewise_construct_t d;
|
||||
x.emplace(d, TUPLE_NAMESPACE::make_tuple(9, 3, 1),
|
||||
TUPLE_NAMESPACE::make_tuple(10));
|
||||
x.emplace(
|
||||
d, TUPLE_NAMESPACE::make_tuple(9, 3, 1), TUPLE_NAMESPACE::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));
|
||||
|
@ -35,8 +35,7 @@ template <typename T> void test_simple_allocator()
|
||||
BOOST_STATIC_ASSERT((boost::is_same<typename traits::allocator_type,
|
||||
SimpleAllocator<T> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<typename traits::value_type, T>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<typename traits::value_type, T>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<typename traits::pointer, T*>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
@ -46,8 +45,8 @@ template <typename T> void test_simple_allocator()
|
||||
// BOOST_STATIC_ASSERT((boost::is_same<typename traits::const_void_pointer,
|
||||
// void const*>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<typename traits::difference_type,
|
||||
std::ptrdiff_t>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<typename traits::difference_type, std::ptrdiff_t>::value));
|
||||
|
||||
#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1
|
||||
BOOST_STATIC_ASSERT((boost::is_same<typename traits::size_type,
|
||||
|
@ -155,15 +155,15 @@ void move_construct_tests2(T*, test::random_generator const& generator)
|
||||
BOOST_TEST(count == test::global_object_count);
|
||||
#elif defined(BOOST_HAS_NRVO)
|
||||
BOOST_TEST(
|
||||
static_cast<std::size_t>(test::global_object_count.constructions -
|
||||
count.constructions) <=
|
||||
static_cast<std::size_t>(
|
||||
test::global_object_count.constructions - count.constructions) <=
|
||||
(test::is_set<T>::value ? 1 : 2) *
|
||||
(test::has_unique_keys<T>::value ? 25 : v.size()));
|
||||
BOOST_TEST(count.instances == test::global_object_count.instances);
|
||||
#else
|
||||
BOOST_TEST(
|
||||
static_cast<std::size_t>(test::global_object_count.constructions -
|
||||
count.constructions) <=
|
||||
static_cast<std::size_t>(
|
||||
test::global_object_count.constructions - count.constructions) <=
|
||||
(test::is_set<T>::value ? 2 : 4) *
|
||||
(test::has_unique_keys<T>::value ? 25 : v.size()));
|
||||
BOOST_TEST(count.instances == test::global_object_count.instances);
|
||||
@ -214,8 +214,7 @@ void move_assign_tests2(T*, test::random_generator const& generator)
|
||||
T y(0, hf, eq, al1);
|
||||
y = create(v, count, hf, eq, al2, 0.5);
|
||||
#if defined(BOOST_HAS_NRVO)
|
||||
if (BOOST_UNORDERED_TEST_MOVING &&
|
||||
allocator_type::is_propagate_on_move) {
|
||||
if (BOOST_UNORDERED_TEST_MOVING && allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(count == test::global_object_count);
|
||||
}
|
||||
#endif
|
||||
@ -246,8 +245,7 @@ void move_assign_tests2(T*, test::random_generator const& generator)
|
||||
|
||||
test::object_count count = test::global_object_count;
|
||||
y = boost::move(x);
|
||||
if (BOOST_UNORDERED_TEST_MOVING &&
|
||||
allocator_type::is_propagate_on_move) {
|
||||
if (BOOST_UNORDERED_TEST_MOVING && allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(count == test::global_object_count);
|
||||
}
|
||||
test::check_container(y, v);
|
||||
@ -280,11 +278,10 @@ void move_assign_tests2(T*, test::random_generator const& generator)
|
||||
|
||||
test::object_count count2 = test::global_object_count;
|
||||
|
||||
if (BOOST_UNORDERED_TEST_MOVING &&
|
||||
allocator_type::is_propagate_on_move) {
|
||||
if (BOOST_UNORDERED_TEST_MOVING && allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(count1.instances == test::global_object_count.instances);
|
||||
BOOST_TEST(count2.constructions ==
|
||||
test::global_object_count.constructions);
|
||||
BOOST_TEST(
|
||||
count2.constructions == test::global_object_count.constructions);
|
||||
}
|
||||
|
||||
test::check_container(y, v2);
|
||||
@ -361,14 +358,14 @@ UNORDERED_TEST(move_assign_tests1,
|
||||
UNORDERED_TEST(move_construct_tests2,
|
||||
((test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_move)(
|
||||
test_multiset_prop_move)(test_map_prop_move)(test_multimap_prop_move)(
|
||||
test_set_no_prop_move)(test_multiset_no_prop_move)(
|
||||
test_map_no_prop_move)(test_multimap_no_prop_move))(
|
||||
test_set_no_prop_move)(test_multiset_no_prop_move)(test_map_no_prop_move)(
|
||||
test_multimap_no_prop_move))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
UNORDERED_TEST(move_assign_tests2,
|
||||
((test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_move)(
|
||||
test_multiset_prop_move)(test_map_prop_move)(test_multimap_prop_move)(
|
||||
test_set_no_prop_move)(test_multiset_no_prop_move)(
|
||||
test_map_no_prop_move)(test_multimap_no_prop_move))(
|
||||
test_set_no_prop_move)(test_multiset_no_prop_move)(test_map_no_prop_move)(
|
||||
test_multimap_no_prop_move))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
}
|
||||
|
||||
|
@ -149,8 +149,8 @@ UNORDERED_AUTO_TEST(failed_insertion_with_hint)
|
||||
}
|
||||
|
||||
template <typename NodeHandle>
|
||||
bool node_handle_compare(NodeHandle const& nh,
|
||||
BOOST_DEDUCED_TYPENAME NodeHandle::value_type const& x)
|
||||
bool node_handle_compare(
|
||||
NodeHandle const& nh, BOOST_DEDUCED_TYPENAME NodeHandle::value_type const& x)
|
||||
{
|
||||
return x == nh.value();
|
||||
}
|
||||
@ -287,8 +287,8 @@ void insert_node_handle_unique(Container1& c1, Container2& c2)
|
||||
BOOST_TEST(!r.inserted);
|
||||
BOOST_TEST_EQ(c2.count(test::get_key<Container1>(v)), count);
|
||||
BOOST_TEST(r.position != c2.end());
|
||||
BOOST_TEST(test::get_key<Container2>(*r.position) ==
|
||||
test::get_key<Container2>(v));
|
||||
BOOST_TEST(
|
||||
test::get_key<Container2>(*r.position) == test::get_key<Container2>(v));
|
||||
BOOST_TEST(r.node);
|
||||
node_handle_compare(r.node, v);
|
||||
}
|
||||
@ -312,8 +312,7 @@ void insert_node_handle_unique2(Container1& c1, Container2& c2)
|
||||
value_type v = *c1.begin();
|
||||
value_type const* v_ptr = boost::addressof(*c1.begin());
|
||||
std::size_t count = c2.count(test::get_key<Container1>(v));
|
||||
insert_return_type2 r =
|
||||
c2.insert(c1.extract(test::get_key<Container1>(v)));
|
||||
insert_return_type2 r = c2.insert(c1.extract(test::get_key<Container1>(v)));
|
||||
if (r.inserted) {
|
||||
BOOST_TEST_EQ(c2.count(test::get_key<Container1>(v)), count + 1);
|
||||
BOOST_TEST(r.position != c2.end());
|
||||
@ -322,8 +321,8 @@ void insert_node_handle_unique2(Container1& c1, Container2& c2)
|
||||
} else {
|
||||
BOOST_TEST_EQ(c2.count(test::get_key<Container1>(v)), count);
|
||||
BOOST_TEST(r.position != c2.end());
|
||||
BOOST_TEST(test::get_key<Container2>(*r.position) ==
|
||||
test::get_key<Container2>(v));
|
||||
BOOST_TEST(
|
||||
test::get_key<Container2>(*r.position) == test::get_key<Container2>(v));
|
||||
BOOST_TEST(r.node);
|
||||
node_handle_compare(r.node, v);
|
||||
}
|
||||
|
@ -42,7 +42,8 @@ template <class X> void rehash_empty_test1(X*)
|
||||
BOOST_TEST(postcondition(x, 10000000));
|
||||
}
|
||||
|
||||
template <class X> void rehash_empty_test2(X*, test::random_generator generator)
|
||||
template <class X>
|
||||
void rehash_empty_test2(X*, test::random_generator generator)
|
||||
{
|
||||
test::random_values<X> v(1000, generator);
|
||||
test::ordered<X> tracker;
|
||||
@ -63,7 +64,8 @@ template <class X> void rehash_empty_test2(X*, test::random_generator generator)
|
||||
BOOST_TEST(postcondition(x, 10000000));
|
||||
}
|
||||
|
||||
template <class X> void rehash_empty_test3(X*, test::random_generator generator)
|
||||
template <class X>
|
||||
void rehash_empty_test3(X*, test::random_generator generator)
|
||||
{
|
||||
test::random_values<X> v(1000, generator);
|
||||
test::ordered<X> tracker;
|
||||
@ -144,8 +146,7 @@ template <class X> void reserve_test1(X*, test::random_generator generator)
|
||||
|
||||
X x;
|
||||
x.max_load_factor(
|
||||
random_mlf
|
||||
? static_cast<float>(std::rand() % 1000) / 500.0f + 0.5f
|
||||
random_mlf ? static_cast<float>(std::rand() % 1000) / 500.0f + 0.5f
|
||||
: 1.0f);
|
||||
x.reserve(test::has_unique_keys<X>::value ? i : v.size());
|
||||
|
||||
@ -175,8 +176,7 @@ template <class X> void reserve_test2(X*, test::random_generator generator)
|
||||
|
||||
X x;
|
||||
x.max_load_factor(
|
||||
random_mlf
|
||||
? static_cast<float>(std::rand() % 1000) / 500.0f + 0.5f
|
||||
random_mlf ? static_cast<float>(std::rand() % 1000) / 500.0f + 0.5f
|
||||
: 1.0f);
|
||||
|
||||
x.reserve(test::has_unique_keys<X>::value ? i : v.size());
|
||||
|
@ -110,8 +110,7 @@ template <class X> void swap_tests2(X* ptr, test::random_generator generator)
|
||||
}
|
||||
|
||||
{
|
||||
test::force_equal_allocator force_(
|
||||
!allocator_type::is_propagate_on_swap);
|
||||
test::force_equal_allocator force_(!allocator_type::is_propagate_on_swap);
|
||||
test::check_instances check_;
|
||||
|
||||
test::random_values<X> vx(50, generator), vy(100, generator);
|
||||
@ -125,15 +124,12 @@ template <class X> void swap_tests2(X* ptr, test::random_generator generator)
|
||||
}
|
||||
|
||||
{
|
||||
test::force_equal_allocator force_(
|
||||
!allocator_type::is_propagate_on_swap);
|
||||
test::force_equal_allocator force_(!allocator_type::is_propagate_on_swap);
|
||||
test::check_instances check_;
|
||||
|
||||
test::random_values<X> vx(100, generator), vy(100, generator);
|
||||
X x(vx.begin(), vx.end(), 0, hasher(1), key_equal(1),
|
||||
allocator_type(1));
|
||||
X y(vy.begin(), vy.end(), 0, hasher(2), key_equal(2),
|
||||
allocator_type(2));
|
||||
X x(vx.begin(), vx.end(), 0, hasher(1), key_equal(1), allocator_type(1));
|
||||
X y(vy.begin(), vy.end(), 0, hasher(2), key_equal(2), allocator_type(2));
|
||||
|
||||
if (allocator_type::is_propagate_on_swap ||
|
||||
x.get_allocator() == y.get_allocator()) {
|
||||
@ -198,19 +194,19 @@ UNORDERED_AUTO_TEST(check_traits)
|
||||
BOOST_TEST(!is_propagate(test_set_no_prop_swap));
|
||||
}
|
||||
|
||||
UNORDERED_TEST(swap_tests1,
|
||||
((test_map_std_alloc)(test_set)(test_multiset)(test_map)(test_multimap)(
|
||||
test_set_prop_swap)(test_multiset_prop_swap)(test_map_prop_swap)(
|
||||
test_multimap_prop_swap)(test_set_no_prop_swap)(
|
||||
test_multiset_no_prop_swap)(test_map_no_prop_swap)(
|
||||
test_multimap_no_prop_swap))(
|
||||
UNORDERED_TEST(
|
||||
swap_tests1, ((test_map_std_alloc)(test_set)(test_multiset)(test_map)(
|
||||
test_multimap)(test_set_prop_swap)(test_multiset_prop_swap)(
|
||||
test_map_prop_swap)(test_multimap_prop_swap)(
|
||||
test_set_no_prop_swap)(test_multiset_no_prop_swap)(
|
||||
test_map_no_prop_swap)(test_multimap_no_prop_swap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(swap_tests2,
|
||||
((test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_swap)(
|
||||
test_multiset_prop_swap)(test_map_prop_swap)(test_multimap_prop_swap)(
|
||||
test_set_no_prop_swap)(test_multiset_no_prop_swap)(
|
||||
test_map_no_prop_swap)(test_multimap_no_prop_swap))(
|
||||
test_set_no_prop_swap)(test_multiset_no_prop_swap)(test_map_no_prop_swap)(
|
||||
test_multimap_no_prop_swap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
}
|
||||
RUN_TESTS()
|
||||
|
@ -139,15 +139,14 @@ std::size_t hash_value(unnecessary_copy_tests::count_copies const& x)
|
||||
BOOST_ERROR("Wrong number of copies."); \
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM \
|
||||
<< "Number of copies: " \
|
||||
<< ::unnecessary_copy_tests::count_copies::copies \
|
||||
<< " expecting: " << n << std::endl; \
|
||||
<< ::unnecessary_copy_tests::count_copies::copies << " expecting: " << n \
|
||||
<< std::endl; \
|
||||
}
|
||||
#define MOVE_COUNT(n) \
|
||||
if (::unnecessary_copy_tests::count_copies::moves != n) { \
|
||||
BOOST_ERROR("Wrong number of moves."); \
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM \
|
||||
<< "Number of moves: " \
|
||||
<< ::unnecessary_copy_tests::count_copies::moves \
|
||||
<< "Number of moves: " << ::unnecessary_copy_tests::count_copies::moves \
|
||||
<< " expecting: " << n << std::endl; \
|
||||
}
|
||||
#define COPY_COUNT_RANGE(a, b) \
|
||||
@ -156,16 +155,15 @@ std::size_t hash_value(unnecessary_copy_tests::count_copies const& x)
|
||||
BOOST_ERROR("Wrong number of copies."); \
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM \
|
||||
<< "Number of copies: " \
|
||||
<< ::unnecessary_copy_tests::count_copies::copies \
|
||||
<< " expecting: [" << a << ", " << b << "]" << std::endl; \
|
||||
<< ::unnecessary_copy_tests::count_copies::copies << " expecting: [" \
|
||||
<< a << ", " << b << "]" << std::endl; \
|
||||
}
|
||||
#define MOVE_COUNT_RANGE(a, b) \
|
||||
if (::unnecessary_copy_tests::count_copies::moves < a || \
|
||||
::unnecessary_copy_tests::count_copies::moves > b) { \
|
||||
BOOST_ERROR("Wrong number of moves."); \
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM \
|
||||
<< "Number of moves: " \
|
||||
<< ::unnecessary_copy_tests::count_copies::moves \
|
||||
<< "Number of moves: " << ::unnecessary_copy_tests::count_copies::moves \
|
||||
<< " expecting: [" << a << ", " << b << "]" << std::endl; \
|
||||
}
|
||||
#define COPY_COUNT_EXTRA(a, b) COPY_COUNT_RANGE(a, a + b * EXTRA_CONSTRUCT_COST)
|
||||
@ -263,7 +261,8 @@ template <class T> void unnecessary_copy_emplace_rvalue_test(T*)
|
||||
#endif
|
||||
}
|
||||
|
||||
UNORDERED_TEST(unnecessary_copy_emplace_test, ((set)(multiset)(map)(multimap)))
|
||||
UNORDERED_TEST(
|
||||
unnecessary_copy_emplace_test, ((set)(multiset)(map)(multimap)))
|
||||
UNORDERED_TEST(
|
||||
unnecessary_copy_emplace_rvalue_test, ((set)(multiset)(map)(multimap)))
|
||||
|
||||
@ -317,7 +316,8 @@ template <class T> void unnecessary_copy_emplace_boost_move_set_test(T*)
|
||||
MOVE_COUNT(1);
|
||||
}
|
||||
|
||||
UNORDERED_TEST(unnecessary_copy_emplace_boost_move_set_test, ((set)(multiset)))
|
||||
UNORDERED_TEST(
|
||||
unnecessary_copy_emplace_boost_move_set_test, ((set)(multiset)))
|
||||
|
||||
template <class T> void unnecessary_copy_emplace_boost_move_map_test(T*)
|
||||
{
|
||||
@ -338,7 +338,8 @@ template <class T> void unnecessary_copy_emplace_boost_move_map_test(T*)
|
||||
#endif
|
||||
}
|
||||
|
||||
UNORDERED_TEST(unnecessary_copy_emplace_boost_move_map_test, ((map)(multimap)))
|
||||
UNORDERED_TEST(
|
||||
unnecessary_copy_emplace_boost_move_map_test, ((map)(multimap)))
|
||||
|
||||
UNORDERED_AUTO_TEST(unnecessary_copy_emplace_set_test)
|
||||
{
|
||||
@ -547,8 +548,7 @@ UNORDERED_AUTO_TEST(unnecessary_copy_emplace_map_test)
|
||||
|
||||
reset();
|
||||
x.emplace(boost::unordered::piecewise_construct,
|
||||
std::make_tuple(std::ref(b.first)),
|
||||
std::make_tuple(std::ref(b.second)));
|
||||
std::make_tuple(std::ref(b.first)), std::make_tuple(std::ref(b.second)));
|
||||
COPY_COUNT(0);
|
||||
MOVE_COUNT(0);
|
||||
|
||||
|
Reference in New Issue
Block a user