mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 10:57:16 +02:00
Merge branch 'develop'
This commit is contained in:
@ -35,4 +35,4 @@ BraceWrapping:
|
||||
PointerAlignment: Left
|
||||
|
||||
# Boost specific stuff
|
||||
ForEachMacros: [ BOOST_FOREACH ]
|
||||
ForEachMacros: [ BOOST_FOREACH, UNORDERED_AUTO_TEST ]
|
||||
|
@ -160,12 +160,9 @@ the expensive rehashing out of the way and let you store iterators, safe in
|
||||
the knowledge that they won't be invalidated. If you are inserting `n`
|
||||
elements into container `x`, you could first call:
|
||||
|
||||
x.rehash((x.size() + n) / x.max_load_factor() + 1);
|
||||
x.rehash((x.size() + n) / x.max_load_factor());
|
||||
|
||||
[blurb Note: `rehash`'s argument is the minimum number of buckets, not the
|
||||
number of elements, which is why the new size is divided by the maximum load factor. The
|
||||
`+ 1` guarantees there is no invalidation; without it, reallocation could occur
|
||||
if the number of bucket exactly divides the target size, since the container is
|
||||
allowed to rehash when the load factor is equal to the maximum load factor.]
|
||||
number of elements, which is why the new size is divided by the maximum load factor.]
|
||||
|
||||
[endsect]
|
||||
|
@ -32,8 +32,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// TODO: Use piecewise construction by default? Is it safe to assume that an
|
||||
// unknown library has it?
|
||||
// Assume that an unknown library does not support piecewise construction.
|
||||
#if !defined(BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT)
|
||||
#define BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 0
|
||||
#endif
|
||||
|
@ -356,13 +356,12 @@ namespace boost {
|
||||
}
|
||||
|
||||
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)(
|
||||
boost::unordered::detail::insert_size(i, j) + 1, num_buckets);
|
||||
boost::unordered::detail::insert_size(i, j), num_buckets);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -384,6 +383,7 @@ namespace boost {
|
||||
|
||||
T& get() { return value_; }
|
||||
T const& get() const { return value_; }
|
||||
|
||||
private:
|
||||
T value_;
|
||||
};
|
||||
@ -1027,17 +1027,17 @@ namespace boost {
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename ValueType, typename... Args>
|
||||
BOOST_UNORDERED_HAS_FUNCTION(
|
||||
construct, U, (boost::unordered::detail::make<ValueType*>(),
|
||||
boost::unordered::detail::make<Args const>()...),
|
||||
BOOST_UNORDERED_HAS_FUNCTION(construct, U,
|
||||
(boost::unordered::detail::make<ValueType*>(),
|
||||
boost::unordered::detail::make<Args const>()...),
|
||||
2);
|
||||
|
||||
#else
|
||||
|
||||
template <typename T, typename ValueType>
|
||||
BOOST_UNORDERED_HAS_FUNCTION(
|
||||
construct, U, (boost::unordered::detail::make<ValueType*>(),
|
||||
boost::unordered::detail::make<ValueType const>()),
|
||||
BOOST_UNORDERED_HAS_FUNCTION(construct, U,
|
||||
(boost::unordered::detail::make<ValueType*>(),
|
||||
boost::unordered::detail::make<ValueType const>()),
|
||||
2);
|
||||
|
||||
#endif
|
||||
@ -2571,7 +2571,6 @@ namespace boost {
|
||||
typedef prime_policy<std::size_t> type;
|
||||
};
|
||||
|
||||
// TODO: Maybe not if std::size_t is smaller than long long.
|
||||
#if !defined(BOOST_NO_LONG_LONG)
|
||||
template <> struct pick_policy2<boost::long_long_type>
|
||||
{
|
||||
@ -2686,7 +2685,7 @@ namespace boost {
|
||||
{
|
||||
construct(current_, bf.current(),
|
||||
boost::unordered::detail::integral_constant<bool,
|
||||
nothrow_move_constructible>());
|
||||
nothrow_move_constructible>());
|
||||
}
|
||||
|
||||
~functions() { this->destroy(current_); }
|
||||
@ -3169,9 +3168,10 @@ namespace boost {
|
||||
|
||||
// I think swap can throw if Propagate::value,
|
||||
// since the allocators' swap can throw. Not sure though.
|
||||
swap_allocators(x, boost::unordered::detail::integral_constant<bool,
|
||||
allocator_traits<node_allocator>::
|
||||
propagate_on_container_swap::value>());
|
||||
swap_allocators(
|
||||
x, boost::unordered::detail::integral_constant<bool,
|
||||
allocator_traits<
|
||||
node_allocator>::propagate_on_container_swap::value>());
|
||||
|
||||
boost::swap(buckets_, x.buckets_);
|
||||
boost::swap(bucket_count_, x.bucket_count_);
|
||||
@ -3197,6 +3197,31 @@ namespace boost {
|
||||
other.max_load_ = 0;
|
||||
}
|
||||
|
||||
// For use in the constructor when allocators might be different.
|
||||
void move_construct_buckets(table& src)
|
||||
{
|
||||
if (this->node_alloc() == src.node_alloc()) {
|
||||
move_buckets_from(src);
|
||||
} else {
|
||||
this->create_buckets(this->bucket_count_);
|
||||
link_pointer prev = this->get_previous_start();
|
||||
std::size_t last_bucket = this->bucket_count_;
|
||||
for (node_pointer n = src.begin(); n; n = next_node(n)) {
|
||||
std::size_t bucket = n->get_bucket();
|
||||
if (bucket != last_bucket) {
|
||||
this->get_bucket(bucket)->next_ = prev;
|
||||
}
|
||||
node_pointer n2 = boost::unordered::detail::func::construct_node(
|
||||
this->node_alloc(), boost::move(n->value()));
|
||||
n2->bucket_info_ = n->bucket_info_;
|
||||
prev->next_ = n2;
|
||||
++size_;
|
||||
prev = n2;
|
||||
last_bucket = bucket;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Delete/destruct
|
||||
|
||||
@ -3294,8 +3319,8 @@ namespace boost {
|
||||
if (this != &x) {
|
||||
assign(x, is_unique,
|
||||
boost::unordered::detail::integral_constant<bool,
|
||||
allocator_traits<node_allocator>::
|
||||
propagate_on_container_copy_assignment::value>());
|
||||
allocator_traits<node_allocator>::
|
||||
propagate_on_container_copy_assignment::value>());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3307,7 +3332,7 @@ namespace boost {
|
||||
mlf_ = x.mlf_;
|
||||
recalculate_max_load();
|
||||
|
||||
if (x.size_ >= max_load_) {
|
||||
if (x.size_ > max_load_) {
|
||||
create_buckets(min_buckets_for_size(x.size_));
|
||||
} else if (size_) {
|
||||
clear_buckets();
|
||||
@ -3350,8 +3375,8 @@ namespace boost {
|
||||
if (this != &x) {
|
||||
move_assign(x, is_unique,
|
||||
boost::unordered::detail::integral_constant<bool,
|
||||
allocator_traits<node_allocator>::
|
||||
propagate_on_container_move_assignment::value>());
|
||||
allocator_traits<node_allocator>::
|
||||
propagate_on_container_move_assignment::value>());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3382,7 +3407,7 @@ namespace boost {
|
||||
mlf_ = x.mlf_;
|
||||
recalculate_max_load();
|
||||
|
||||
if (x.size_ >= max_load_) {
|
||||
if (x.size_ > max_load_) {
|
||||
create_buckets(min_buckets_for_size(x.size_));
|
||||
} else if (size_) {
|
||||
clear_buckets();
|
||||
@ -3524,9 +3549,8 @@ namespace boost {
|
||||
std::size_t bucket_index = this->hash_to_bucket(key_hash);
|
||||
bucket_pointer b = this->get_bucket(bucket_index);
|
||||
|
||||
// TODO: Do this need to set_first_in_group ?
|
||||
n->bucket_info_ = bucket_index;
|
||||
// n->set_first_in_group();
|
||||
n->set_first_in_group();
|
||||
|
||||
if (!b->next_) {
|
||||
link_pointer start_node = this->get_previous_start();
|
||||
@ -3922,20 +3946,6 @@ namespace boost {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Should be move_buckets_uniq
|
||||
void move_buckets(table const& src)
|
||||
{
|
||||
this->create_buckets(this->bucket_count_);
|
||||
|
||||
for (node_pointer n = src.begin(); n; n = next_node(n)) {
|
||||
std::size_t key_hash = this->hash(this->get_key(n));
|
||||
this->add_node_unique(
|
||||
boost::unordered::detail::func::construct_node(
|
||||
this->node_alloc(), boost::move(n->value())),
|
||||
key_hash);
|
||||
}
|
||||
}
|
||||
|
||||
void assign_buckets(table const& src, true_type)
|
||||
{
|
||||
node_holder<node_allocator> holder(*this);
|
||||
@ -4062,7 +4072,7 @@ namespace boost {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// n->set_first_in_group();
|
||||
n->set_first_in_group();
|
||||
bucket_pointer b = this->get_bucket(bucket_index);
|
||||
|
||||
if (!b->next_) {
|
||||
@ -4211,9 +4221,9 @@ namespace boost {
|
||||
}
|
||||
|
||||
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(
|
||||
@ -4328,26 +4338,6 @@ namespace boost {
|
||||
}
|
||||
}
|
||||
|
||||
void move_buckets_equiv(table const& src)
|
||||
{
|
||||
this->create_buckets(this->bucket_count_);
|
||||
|
||||
for (node_pointer n = src.begin(); n;) {
|
||||
std::size_t key_hash = this->hash(this->get_key(n));
|
||||
node_pointer group_end(next_group(n));
|
||||
node_pointer pos = this->add_node_equiv(
|
||||
boost::unordered::detail::func::construct_node(
|
||||
this->node_alloc(), boost::move(n->value())),
|
||||
key_hash, node_pointer());
|
||||
for (n = next_node(n); n != group_end; n = next_node(n)) {
|
||||
this->add_node_equiv(
|
||||
boost::unordered::detail::func::construct_node(
|
||||
this->node_alloc(), boost::move(n->value())),
|
||||
key_hash, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void assign_buckets(table const& src, false_type)
|
||||
{
|
||||
node_holder<node_allocator> holder(*this);
|
||||
@ -4680,8 +4670,9 @@ namespace boost {
|
||||
template <typename A, typename T>
|
||||
struct node : boost::unordered::detail::value_base<T>
|
||||
{
|
||||
typedef typename ::boost::unordered::detail::rebind_wrap<A,
|
||||
node<A, T> >::type allocator;
|
||||
typedef
|
||||
typename ::boost::unordered::detail::rebind_wrap<A, node<A, T> >::type
|
||||
allocator;
|
||||
typedef typename ::boost::unordered::detail::allocator_traits<
|
||||
allocator>::pointer node_pointer;
|
||||
typedef node_pointer link_pointer;
|
||||
|
@ -19,8 +19,9 @@ namespace boost {
|
||||
typedef P key_equal;
|
||||
typedef K const const_key_type;
|
||||
|
||||
typedef typename ::boost::unordered::detail::rebind_wrap<A,
|
||||
value_type>::type value_allocator;
|
||||
typedef
|
||||
typename ::boost::unordered::detail::rebind_wrap<A, value_type>::type
|
||||
value_allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
value_allocator_traits;
|
||||
|
||||
|
@ -18,8 +18,9 @@ namespace boost {
|
||||
typedef P key_equal;
|
||||
typedef T const const_key_type;
|
||||
|
||||
typedef typename ::boost::unordered::detail::rebind_wrap<A,
|
||||
value_type>::type value_allocator;
|
||||
typedef
|
||||
typename ::boost::unordered::detail::rebind_wrap<A, value_type>::type
|
||||
value_allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
value_allocator_traits;
|
||||
|
||||
|
@ -309,7 +309,7 @@ namespace boost {
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(boost::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
@ -317,19 +317,19 @@ namespace boost {
|
||||
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)));
|
||||
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>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
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), boost::forward<A2>(a2)));
|
||||
}
|
||||
@ -354,9 +354,9 @@ namespace boost {
|
||||
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( \
|
||||
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_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
}
|
||||
@ -532,8 +532,7 @@ namespace boost {
|
||||
std::pair<iterator, bool> try_emplace(key_type const& k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_unique(
|
||||
k,
|
||||
return table_.try_emplace_unique(k,
|
||||
boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1), boost::forward<A2>(a2)));
|
||||
}
|
||||
@ -562,8 +561,7 @@ namespace boost {
|
||||
std::pair<iterator, bool> try_emplace(BOOST_RV_REF(key_type) k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_unique(
|
||||
boost::move(k),
|
||||
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)));
|
||||
}
|
||||
@ -592,8 +590,7 @@ namespace boost {
|
||||
iterator try_emplace(const_iterator hint, key_type const& k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, k,
|
||||
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)));
|
||||
}
|
||||
@ -614,16 +611,15 @@ namespace boost {
|
||||
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)));
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0), boost::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k,
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, boost::move(k),
|
||||
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)));
|
||||
}
|
||||
@ -644,8 +640,8 @@ namespace boost {
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.try_emplace_unique(boost::move(k), \
|
||||
boost::unordered::detail::create_emplace_args(BOOST_PP_ENUM_##z( \
|
||||
n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
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)> \
|
||||
@ -662,8 +658,8 @@ namespace boost {
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
|
||||
{ \
|
||||
return table_.try_emplace_hint_unique(hint, boost::move(k), \
|
||||
boost::unordered::detail::create_emplace_args(BOOST_PP_ENUM_##z( \
|
||||
n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
}
|
||||
|
||||
BOOST_UNORDERED_TRY_EMPLACE(1, 4, _)
|
||||
@ -1105,8 +1101,7 @@ namespace boost {
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint,
|
||||
return iterator(table_.emplace_hint_equiv(hint,
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)))));
|
||||
@ -1429,12 +1424,7 @@ namespace boost {
|
||||
BOOST_RV_REF(unordered_map) other, allocator_type const& a)
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
if (table_.node_alloc() == other.table_.node_alloc()) {
|
||||
table_.move_buckets_from(other.table_);
|
||||
} else if (other.table_.size_) {
|
||||
// TODO: Could pick new bucket size?
|
||||
table_.move_buckets(other.table_);
|
||||
}
|
||||
table_.move_construct_buckets(other.table_);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@ -1913,12 +1903,7 @@ namespace boost {
|
||||
BOOST_RV_REF(unordered_multimap) other, allocator_type const& a)
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
if (table_.node_alloc() == other.table_.node_alloc()) {
|
||||
table_.move_buckets_from(other.table_);
|
||||
} else if (other.table_.size_) {
|
||||
// TODO: Could pick new bucket size?
|
||||
table_.move_buckets_equiv(other.table_);
|
||||
}
|
||||
table_.move_construct_buckets(other.table_);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
@ -307,7 +307,7 @@ namespace boost {
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(boost::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)));
|
||||
boost::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
@ -315,19 +315,19 @@ namespace boost {
|
||||
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)));
|
||||
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>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace_hint_unique(
|
||||
hint, table::extractor::extract(
|
||||
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), boost::forward<A2>(a2)));
|
||||
}
|
||||
@ -352,9 +352,9 @@ namespace boost {
|
||||
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( \
|
||||
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_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
|
||||
}
|
||||
@ -813,8 +813,7 @@ namespace boost {
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint,
|
||||
return iterator(table_.emplace_hint_equiv(hint,
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0)))));
|
||||
@ -1109,12 +1108,7 @@ namespace boost {
|
||||
BOOST_RV_REF(unordered_set) other, allocator_type const& a)
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
if (table_.node_alloc() == other.table_.node_alloc()) {
|
||||
table_.move_buckets_from(other.table_);
|
||||
} else if (other.table_.size_) {
|
||||
// TODO: Could pick new bucket size?
|
||||
table_.move_buckets(other.table_);
|
||||
}
|
||||
table_.move_construct_buckets(other.table_);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
@ -1511,12 +1505,7 @@ namespace boost {
|
||||
BOOST_RV_REF(unordered_multiset) other, allocator_type const& a)
|
||||
: table_(other.table_, a, boost::unordered::detail::move_tag())
|
||||
{
|
||||
if (table_.node_alloc() == other.table_.node_alloc()) {
|
||||
table_.move_buckets_from(other.table_);
|
||||
} else if (other.table_.size_) {
|
||||
// TODO: Could pick new bucket size?
|
||||
table_.move_buckets_equiv(other.table_);
|
||||
}
|
||||
table_.move_construct_buckets(other.table_);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
@ -199,11 +199,14 @@ template <class T> struct copy_range_construct_test : public range<T>, objects
|
||||
}
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
EXCEPTION_TESTS(
|
||||
(construct_test1)(construct_test2)(construct_test3)(construct_test4)(
|
||||
construct_test5)(construct_test6)(range_construct_test1)(
|
||||
range_construct_test2)(range_construct_test3)(range_construct_test4)(
|
||||
range_construct_test5)(input_range_construct_test)(
|
||||
copy_range_construct_test),
|
||||
(construct_test1)(construct_test2)(construct_test3)(construct_test4)
|
||||
(construct_test5)(construct_test6)(range_construct_test1)
|
||||
(range_construct_test2)(range_construct_test3)(range_construct_test4)
|
||||
(range_construct_test5)(input_range_construct_test)
|
||||
(copy_range_construct_test),
|
||||
CONTAINER_SEQ)
|
||||
// clang-format on
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -121,8 +121,12 @@ template <class T> struct equivalent_test1 : move_assign_base<T>
|
||||
}
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
EXCEPTION_TESTS(
|
||||
(move_assign_test1)(move_assign_test2)(move_assign_test3)(move_assign_test4)(
|
||||
move_assign_test4a)(move_assign_test5)(equivalent_test1),
|
||||
(move_assign_test1)(move_assign_test2)(move_assign_test3)
|
||||
(move_assign_test4)(move_assign_test4a)(move_assign_test5)
|
||||
(equivalent_test1),
|
||||
CONTAINER_SEQ)
|
||||
// clang-format on
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -123,7 +123,11 @@ template <class T> struct rehash_test5 : rehash_test_base<T>
|
||||
}
|
||||
};
|
||||
|
||||
EXCEPTION_TESTS((rehash_test0)(rehash_test1)(rehash_test2)(rehash_test3)(
|
||||
rehash_test4)(rehash_test5),
|
||||
// clang-format off
|
||||
EXCEPTION_TESTS(
|
||||
(rehash_test0)(rehash_test1)(rehash_test2)(rehash_test3)(rehash_test4)
|
||||
(rehash_test5),
|
||||
CONTAINER_SEQ)
|
||||
// clang-format on
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -135,7 +135,11 @@ template <class T> struct swap_test4 : swap_base<T>
|
||||
swap_test4() : swap_base<T>(10, 10, 1, 2) {}
|
||||
};
|
||||
|
||||
EXCEPTION_TESTS((self_swap_test1)(self_swap_test2)(swap_test1)(swap_test2)(
|
||||
swap_test3)(swap_test4),
|
||||
// clang-format off
|
||||
EXCEPTION_TESTS(
|
||||
(self_swap_test1)(self_swap_test2)
|
||||
(swap_test1)(swap_test2)(swap_test3)(swap_test4),
|
||||
CONTAINER_SEQ)
|
||||
// clang-format on
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -14,16 +14,14 @@
|
||||
#include <boost/preprocessor/seq/for_each_product.hpp>
|
||||
|
||||
#define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \
|
||||
UNORDERED_AUTO_TEST(name) \
|
||||
{ \
|
||||
UNORDERED_AUTO_TEST (name) { \
|
||||
test_func<type> fixture; \
|
||||
::test::lightweight::exception_safety( \
|
||||
fixture, BOOST_STRINGIZE(test_func<type>)); \
|
||||
}
|
||||
|
||||
#define UNORDERED_EXCEPTION_TEST_CASE_REPEAT(name, test_func, n, type) \
|
||||
UNORDERED_AUTO_TEST(name) \
|
||||
{ \
|
||||
UNORDERED_AUTO_TEST (name) { \
|
||||
for (unsigned i = 0; i < n; ++i) { \
|
||||
test_func<type> fixture; \
|
||||
::test::lightweight::exception_safety( \
|
||||
|
@ -97,8 +97,9 @@ namespace test {
|
||||
|
||||
// Check the load factor.
|
||||
|
||||
float load_factor = size == 0 ? 0 : static_cast<float>(size) /
|
||||
static_cast<float>(x1.bucket_count());
|
||||
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)
|
||||
BOOST_ERROR("x1.load_factor() doesn't match actual load_factor.");
|
||||
|
@ -163,9 +163,8 @@ namespace test {
|
||||
BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_TAIL(product)))
|
||||
|
||||
#define UNORDERED_TEST_OP2(name, n, params) \
|
||||
UNORDERED_AUTO_TEST( \
|
||||
BOOST_PP_SEQ_FOLD_LEFT(UNORDERED_TEST_OP_JOIN, name, params)) \
|
||||
{ \
|
||||
UNORDERED_AUTO_TEST ( \
|
||||
BOOST_PP_SEQ_FOLD_LEFT(UNORDERED_TEST_OP_JOIN, name, params)) { \
|
||||
for (int i = 0; i < n; ++i) \
|
||||
name BOOST_PP_SEQ_TO_TUPLE(params); \
|
||||
}
|
||||
@ -177,8 +176,7 @@ namespace test {
|
||||
UNORDERED_MULTI_TEST_REPEAT(name, impl, 1, parameters)
|
||||
|
||||
#define UNORDERED_MULTI_TEST_REPEAT(name, impl, n, parameters) \
|
||||
UNORDERED_AUTO_TEST(name) \
|
||||
{ \
|
||||
UNORDERED_AUTO_TEST (name) { \
|
||||
BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
|
||||
UNORDERED_MULTI_TEST_OP, ((impl))((n))parameters) \
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ namespace test {
|
||||
destructible(constructor_param const&) {}
|
||||
~destructible() {}
|
||||
void dummy_member() const {}
|
||||
|
||||
private:
|
||||
destructible(destructible const&);
|
||||
destructible& operator=(destructible const&);
|
||||
@ -68,6 +69,7 @@ namespace test {
|
||||
copy_constructible(copy_constructible const&) {}
|
||||
~copy_constructible() {}
|
||||
void dummy_member() const {}
|
||||
|
||||
private:
|
||||
copy_constructible& operator=(copy_constructible const&);
|
||||
copy_constructible() {}
|
||||
@ -86,6 +88,7 @@ namespace test {
|
||||
~copy_constructible_equality_comparable() {}
|
||||
|
||||
void dummy_member() const {}
|
||||
|
||||
private:
|
||||
copy_constructible_equality_comparable& operator=(
|
||||
copy_constructible_equality_comparable const&);
|
||||
@ -141,6 +144,7 @@ namespace test {
|
||||
assignable& operator=(assignable const&) { return *this; }
|
||||
~assignable() {}
|
||||
void dummy_member() const {}
|
||||
|
||||
private:
|
||||
assignable() {}
|
||||
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
|
||||
@ -179,6 +183,7 @@ namespace test {
|
||||
~movable2() {}
|
||||
movable2& operator=(movable2&&) { return *this; }
|
||||
void dummy_member() const {}
|
||||
|
||||
private:
|
||||
movable2() {}
|
||||
movable2(movable2 const&);
|
||||
@ -285,6 +290,7 @@ namespace test {
|
||||
T* ptr_;
|
||||
|
||||
ptr(T* x) : ptr_(x) {}
|
||||
|
||||
public:
|
||||
ptr() : ptr_(0) {}
|
||||
explicit ptr(void_ptr const& x) : ptr_((T*)x.ptr_) {}
|
||||
@ -336,6 +342,7 @@ namespace test {
|
||||
T const* ptr_;
|
||||
|
||||
const_ptr(T const* ptr) : ptr_(ptr) {}
|
||||
|
||||
public:
|
||||
const_ptr() : ptr_(0) {}
|
||||
const_ptr(ptr<T> const& x) : ptr_(x.ptr_) {}
|
||||
|
@ -497,6 +497,7 @@ namespace test {
|
||||
T* ptr_;
|
||||
|
||||
ptr(T* x) : ptr_(x) {}
|
||||
|
||||
public:
|
||||
ptr() : ptr_(0) {}
|
||||
explicit ptr(void_ptr const& x) : ptr_((T*)x.ptr_) {}
|
||||
@ -539,6 +540,7 @@ namespace test {
|
||||
T const* ptr_;
|
||||
|
||||
const_ptr(T const* ptr) : ptr_(ptr) {}
|
||||
|
||||
public:
|
||||
const_ptr() : ptr_(0) {}
|
||||
const_ptr(ptr<T> const& x) : ptr_(x.ptr_) {}
|
||||
|
@ -242,8 +242,7 @@ namespace assign_tests {
|
||||
return T::allocator_type::is_propagate_on_assign;
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(check_traits)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (check_traits) {
|
||||
BOOST_TEST(!is_propagate(test_set));
|
||||
BOOST_TEST(is_propagate(test_set_prop_assign));
|
||||
BOOST_TEST(!is_propagate(test_set_no_prop_assign));
|
||||
@ -255,7 +254,7 @@ namespace assign_tests {
|
||||
test_multimap_prop_assign)(test_set_no_prop_assign)(
|
||||
test_multiset_no_prop_assign)(test_map_no_prop_assign)(
|
||||
test_multimap_no_prop_assign))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(
|
||||
assign_tests2, ((test_set)(test_multiset)(test_map)(test_multimap)(
|
||||
@ -267,8 +266,7 @@ namespace assign_tests {
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
||||
UNORDERED_AUTO_TEST(assign_default_initializer_list)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (assign_default_initializer_list) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n";
|
||||
std::initializer_list<std::pair<int const, int> > init;
|
||||
boost::unordered_map<int, int> x1;
|
||||
@ -282,8 +280,7 @@ namespace assign_tests {
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
UNORDERED_AUTO_TEST(assign_initializer_list)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (assign_initializer_list) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n";
|
||||
|
||||
boost::unordered_set<int> x;
|
||||
|
@ -14,8 +14,7 @@
|
||||
|
||||
namespace at_tests {
|
||||
|
||||
UNORDERED_AUTO_TEST(at_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (at_tests) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Create Map" << std::endl;
|
||||
|
||||
boost::unordered_map<std::string, int> x;
|
||||
|
@ -36,8 +36,7 @@ INSTANTIATE(multimap)<test::minimal::assignable, test::minimal::assignable,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<int> >;
|
||||
|
||||
UNORDERED_AUTO_TEST(test0)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test0) {
|
||||
test::minimal::constructor_param x;
|
||||
|
||||
typedef std::pair<test::minimal::assignable const, test::minimal::assignable>
|
||||
@ -81,8 +80,7 @@ UNORDERED_AUTO_TEST(test0)
|
||||
container_test(multimap, value);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (equality_tests) {
|
||||
typedef std::pair<test::minimal::copy_constructible_equality_comparable const,
|
||||
test::minimal::copy_constructible_equality_comparable>
|
||||
value_type;
|
||||
@ -97,7 +95,7 @@ UNORDERED_AUTO_TEST(equality_tests)
|
||||
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::copy_constructible_equality_comparable>,
|
||||
test::minimal::allocator<value_type> >
|
||||
map;
|
||||
|
||||
@ -125,8 +123,7 @@ UNORDERED_AUTO_TEST(equality_tests)
|
||||
equality_test(multimap);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(test1)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test1) {
|
||||
boost::hash<int> hash;
|
||||
std::equal_to<int> equal_to;
|
||||
int value = 0;
|
||||
@ -167,8 +164,7 @@ UNORDERED_AUTO_TEST(test1)
|
||||
unordered_copyable_test(multimap2, value, map_value, hash, equal_to);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(test2)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test2) {
|
||||
test::minimal::constructor_param x;
|
||||
|
||||
test::minimal::assignable assignable(x);
|
||||
@ -235,8 +231,7 @@ std::size_t hash_value(lwg2059_key x)
|
||||
|
||||
bool operator==(lwg2059_key x, lwg2059_key y) { return x.value == y.value; }
|
||||
|
||||
UNORDERED_AUTO_TEST(lwg2059)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (lwg2059) {
|
||||
{
|
||||
boost::unordered_map<lwg2059_key, int> x;
|
||||
x.emplace(lwg2059_key(10), 5);
|
||||
|
@ -35,8 +35,7 @@ INSTANTIATE(multiset)<test::minimal::assignable,
|
||||
test::minimal::equal_to<test::minimal::assignable>,
|
||||
test::minimal::allocator<int> >;
|
||||
|
||||
UNORDERED_AUTO_TEST(test0)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test0) {
|
||||
test::minimal::constructor_param x;
|
||||
|
||||
test::minimal::assignable assignable(x);
|
||||
@ -78,8 +77,7 @@ UNORDERED_AUTO_TEST(test0)
|
||||
container_test(multiset, assignable);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (equality_tests) {
|
||||
typedef test::minimal::copy_constructible_equality_comparable value_type;
|
||||
|
||||
boost::unordered_set<int> int_set;
|
||||
@ -91,7 +89,7 @@ UNORDERED_AUTO_TEST(equality_tests)
|
||||
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::copy_constructible_equality_comparable>,
|
||||
test::minimal::allocator<value_type> >
|
||||
set;
|
||||
|
||||
@ -118,8 +116,7 @@ UNORDERED_AUTO_TEST(equality_tests)
|
||||
equality_test(multiset);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(test1)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test1) {
|
||||
boost::hash<int> hash;
|
||||
std::equal_to<int> equal_to;
|
||||
int value = 0;
|
||||
@ -157,8 +154,7 @@ UNORDERED_AUTO_TEST(test1)
|
||||
unordered_copyable_test(multiset2, value, value, hash, equal_to);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(test2)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test2) {
|
||||
test::minimal::constructor_param x;
|
||||
|
||||
test::minimal::assignable assignable(x);
|
||||
@ -193,8 +189,7 @@ UNORDERED_AUTO_TEST(test2)
|
||||
unordered_set_member_test(multiset, assignable);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(movable1_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (movable1_tests) {
|
||||
test::minimal::constructor_param x;
|
||||
|
||||
test::minimal::movable1 movable1(x);
|
||||
@ -226,8 +221,7 @@ UNORDERED_AUTO_TEST(movable1_tests)
|
||||
unordered_movable_test(multiset, movable1, movable1, hash, equal_to);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(movable2_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (movable2_tests) {
|
||||
test::minimal::constructor_param x;
|
||||
|
||||
test::minimal::movable2 movable2(x);
|
||||
@ -259,8 +253,7 @@ UNORDERED_AUTO_TEST(movable2_tests)
|
||||
unordered_movable_test(multiset, movable2, movable2, hash, equal_to);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(destructible_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (destructible_tests) {
|
||||
test::minimal::constructor_param x;
|
||||
|
||||
test::minimal::destructible destructible(x);
|
||||
@ -303,8 +296,7 @@ std::size_t hash_value(lwg2059_key x)
|
||||
|
||||
bool operator==(lwg2059_key x, lwg2059_key y) { return x.value == y.value; }
|
||||
|
||||
UNORDERED_AUTO_TEST(lwg2059)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (lwg2059) {
|
||||
{
|
||||
boost::unordered_set<lwg2059_key> x;
|
||||
x.emplace(lwg2059_key(10));
|
||||
|
@ -415,20 +415,19 @@ namespace constructor_tests {
|
||||
|
||||
UNORDERED_TEST(constructor_tests1,
|
||||
((test_map_std_alloc)(test_set)(test_multiset)(test_map)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(constructor_tests2,
|
||||
((test_set)(test_multiset)(test_map)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(map_constructor_test,
|
||||
((test_map_std_alloc)(test_map)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
||||
UNORDERED_AUTO_TEST(test_default_initializer_list)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test_default_initializer_list) {
|
||||
std::initializer_list<int> init;
|
||||
boost::unordered_set<int> x1 = init;
|
||||
BOOST_TEST(x1.empty());
|
||||
@ -438,8 +437,7 @@ namespace constructor_tests {
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
||||
UNORDERED_AUTO_TEST(test_initializer_list)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test_initializer_list) {
|
||||
boost::unordered_set<int> x1 = {2, 10, 45, -5};
|
||||
BOOST_TEST(x1.find(10) != x1.end());
|
||||
BOOST_TEST(x1.find(46) == x1.end());
|
||||
|
@ -195,7 +195,7 @@ namespace copy_tests {
|
||||
test_multimap_select_copy)(test_set_no_select_copy)(
|
||||
test_multiset_no_select_copy)(test_map_no_select_copy)(
|
||||
test_multimap_no_select_copy))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(copy_construct_tests2,
|
||||
((test_set)(test_multiset)(test_map)(test_multimap)(test_set_select_copy)(
|
||||
@ -203,7 +203,7 @@ namespace copy_tests {
|
||||
test_multimap_select_copy)(test_set_no_select_copy)(
|
||||
test_multiset_no_select_copy)(test_map_no_select_copy)(
|
||||
test_multimap_no_select_copy))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -51,8 +51,7 @@ void test_prev_prime(std::size_t value)
|
||||
}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(next_prime_test)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (next_prime_test) {
|
||||
BOOST_TEST(!is_prime(0));
|
||||
BOOST_TEST(!is_prime(1));
|
||||
BOOST_TEST(is_prime(2));
|
||||
|
@ -167,8 +167,7 @@ namespace emplace_tests {
|
||||
emplace_value(emplace_value const&);
|
||||
};
|
||||
|
||||
UNORDERED_AUTO_TEST(emplace_set)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (emplace_set) {
|
||||
test::check_instances check_;
|
||||
|
||||
typedef boost::unordered_set<emplace_value, boost::hash<emplace_value> >
|
||||
@ -249,8 +248,7 @@ namespace emplace_tests {
|
||||
BOOST_TEST(x.count(v4) == 1);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(emplace_multiset)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (emplace_multiset) {
|
||||
test::check_instances check_;
|
||||
|
||||
typedef boost::unordered_multiset<emplace_value,
|
||||
@ -328,8 +326,7 @@ namespace emplace_tests {
|
||||
BOOST_TEST_EQ(x.count(v3), 2u);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(emplace_map)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (emplace_map) {
|
||||
test::check_instances check_;
|
||||
|
||||
typedef boost::unordered_map<emplace_value, emplace_value,
|
||||
@ -400,8 +397,7 @@ namespace emplace_tests {
|
||||
BOOST_TEST_EQ(check_.constructions(), 16);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(emplace_multimap)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (emplace_multimap) {
|
||||
test::check_instances check_;
|
||||
|
||||
typedef boost::unordered_multimap<emplace_value, emplace_value,
|
||||
@ -466,8 +462,7 @@ namespace emplace_tests {
|
||||
BOOST_TEST_EQ(check_.constructions(), 20);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(try_emplace)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (try_emplace) {
|
||||
test::check_instances check_;
|
||||
|
||||
typedef boost::unordered_map<int, emplace_value> container;
|
||||
|
@ -31,43 +31,42 @@ namespace equality_tests {
|
||||
};
|
||||
|
||||
#define UNORDERED_EQUALITY_SET_TEST(seq1, op, seq2) \
|
||||
{ \
|
||||
do { \
|
||||
boost::unordered_set<int, mod_compare, mod_compare> set1, set2; \
|
||||
BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \
|
||||
BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \
|
||||
BOOST_TEST(set1 op set2); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define UNORDERED_EQUALITY_MULTISET_TEST(seq1, op, seq2) \
|
||||
{ \
|
||||
do { \
|
||||
boost::unordered_multiset<int, mod_compare, mod_compare> set1, set2; \
|
||||
BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set1, seq1) \
|
||||
BOOST_PP_SEQ_FOR_EACH(UNORDERED_SET_INSERT, set2, seq2) \
|
||||
BOOST_TEST(set1 op set2); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define UNORDERED_EQUALITY_MAP_TEST(seq1, op, seq2) \
|
||||
{ \
|
||||
do { \
|
||||
boost::unordered_map<int, int, mod_compare, mod_compare> map1, map2; \
|
||||
BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map1, seq1) \
|
||||
BOOST_PP_SEQ_FOR_EACH(UNORDERED_MAP_INSERT, map2, seq2) \
|
||||
BOOST_TEST(map1 op map2); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define UNORDERED_EQUALITY_MULTIMAP_TEST(seq1, op, seq2) \
|
||||
{ \
|
||||
do { \
|
||||
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); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define UNORDERED_SET_INSERT(r, set, item) set.insert(item);
|
||||
#define UNORDERED_MAP_INSERT(r, map, item) \
|
||||
map.insert(std::pair<int const, int> BOOST_PP_SEQ_TO_TUPLE(item));
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_size_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (equality_size_tests) {
|
||||
boost::unordered_set<int> x1, x2;
|
||||
BOOST_TEST(x1 == x2);
|
||||
BOOST_TEST(!(x1 != x2));
|
||||
@ -89,49 +88,44 @@ namespace equality_tests {
|
||||
BOOST_TEST(!(x2 == x1));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_key_value_tests)
|
||||
{
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((1), !=, (2))
|
||||
UNORDERED_EQUALITY_SET_TEST((2), ==, (2))
|
||||
UNORDERED_EQUALITY_MAP_TEST(((1)(1))((2)(1)), !=, ((1)(1))((3)(1)))
|
||||
UNORDERED_AUTO_TEST (equality_key_value_tests) {
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((1), !=, (2));
|
||||
UNORDERED_EQUALITY_SET_TEST((2), ==, (2));
|
||||
UNORDERED_EQUALITY_MAP_TEST(((1)(1))((2)(1)), !=, ((1)(1))((3)(1)));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_collision_test)
|
||||
{
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((1), !=, (501))
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((1)(251), !=, (1)(501))
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(((251)(1))((1)(1)), !=, ((501)(1))((1)(1)))
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((1)(501), ==, (1)(501))
|
||||
UNORDERED_EQUALITY_SET_TEST((1)(501), ==, (501)(1))
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_group_size_test)
|
||||
{
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((10)(20)(20), !=, (10)(10)(20))
|
||||
UNORDERED_AUTO_TEST (equality_collision_test) {
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((1), !=, (501));
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((1)(251), !=, (1)(501));
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(
|
||||
((10)(1))((20)(1))((20)(1)), !=, ((10)(1))((20)(1))((10)(1)))
|
||||
((251)(1))((1)(1)), !=, ((501)(1))((1)(1)));
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((1)(501), ==, (1)(501));
|
||||
UNORDERED_EQUALITY_SET_TEST((1)(501), ==, (501)(1));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST (equality_group_size_test) {
|
||||
UNORDERED_EQUALITY_MULTISET_TEST((10)(20)(20), !=, (10)(10)(20));
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(
|
||||
((20)(1))((10)(1))((10)(1)), ==, ((10)(1))((20)(1))((10)(1)))
|
||||
((10)(1))((20)(1))((20)(1)), !=, ((10)(1))((20)(1))((10)(1)));
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(
|
||||
((20)(1))((10)(1))((10)(1)), ==, ((10)(1))((20)(1))((10)(1)));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_map_value_test)
|
||||
{
|
||||
UNORDERED_EQUALITY_MAP_TEST(((1)(1)), !=, ((1)(2)))
|
||||
UNORDERED_EQUALITY_MAP_TEST(((1)(1)), ==, ((1)(1)))
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(1)), !=, ((1)(2)))
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(1))((1)(1)), !=, ((1)(1))((1)(2)))
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(2))((1)(1)), ==, ((1)(1))((1)(2)))
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(2))((1)(1)), !=, ((1)(1))((1)(3)))
|
||||
UNORDERED_AUTO_TEST (equality_map_value_test) {
|
||||
UNORDERED_EQUALITY_MAP_TEST(((1)(1)), !=, ((1)(2)));
|
||||
UNORDERED_EQUALITY_MAP_TEST(((1)(1)), ==, ((1)(1)));
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(1)), !=, ((1)(2)));
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(1))((1)(1)), !=, ((1)(1))((1)(2)));
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(2))((1)(1)), ==, ((1)(1))((1)(2)));
|
||||
UNORDERED_EQUALITY_MULTIMAP_TEST(((1)(2))((1)(1)), !=, ((1)(1))((1)(3)));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_predicate_test)
|
||||
{
|
||||
UNORDERED_EQUALITY_SET_TEST((1), !=, (1001))
|
||||
UNORDERED_EQUALITY_MAP_TEST(((1)(2))((1001)(1)), !=, ((1001)(2))((1)(1)))
|
||||
UNORDERED_AUTO_TEST (equality_predicate_test) {
|
||||
UNORDERED_EQUALITY_SET_TEST((1), !=, (1001));
|
||||
UNORDERED_EQUALITY_MAP_TEST(((1)(2))((1001)(1)), !=, ((1001)(2))((1)(1)));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_multiple_group_test)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (equality_multiple_group_test) {
|
||||
UNORDERED_EQUALITY_MULTISET_TEST(
|
||||
(1)(1)(1)(1001)(2001)(2001)(2)(1002)(3)(1003)(2003), ==,
|
||||
(3)(1003)(2003)(1002)(2)(2001)(2001)(1)(1001)(1)(1));
|
||||
@ -140,8 +134,7 @@ namespace equality_tests {
|
||||
// Test that equality still works when the two containers have
|
||||
// different hash functions but the same equality predicate.
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_different_hash_test)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (equality_different_hash_test) {
|
||||
typedef boost::unordered_set<int, mod_compare, mod_compare> set;
|
||||
set set1(0, mod_compare(false), mod_compare(false));
|
||||
set set2(0, mod_compare(true), mod_compare(true));
|
||||
|
@ -35,8 +35,7 @@ void test_equal_insertion(Iterator begin, Iterator end)
|
||||
test::check_equivalent_keys(x1);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(set_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (set_tests) {
|
||||
int values[][5] = {{1}, {54, 23}, {-13, 65}, {77, 77}, {986, 25, 986}};
|
||||
|
||||
typedef boost::unordered_set<int> set;
|
||||
@ -55,8 +54,7 @@ UNORDERED_AUTO_TEST(set_tests)
|
||||
test_equal_insertion<multiset>(values[4], values[4] + 3);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(map_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (map_tests) {
|
||||
typedef test::list<std::pair<int const, int> > values_type;
|
||||
values_type v[5];
|
||||
v[0].push_back(std::pair<int const, int>(1, 1));
|
||||
|
@ -73,8 +73,7 @@ typedef boost::unordered_multimap<int, int, collision3_hash, std::equal_to<int>,
|
||||
typedef collide_map::value_type collide_value;
|
||||
typedef test::list<collide_value> collide_list;
|
||||
|
||||
UNORDERED_AUTO_TEST(empty_range_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (empty_range_tests) {
|
||||
collide_map x;
|
||||
x.erase(x.begin(), x.end());
|
||||
x.erase(x.begin(), x.begin());
|
||||
@ -82,8 +81,7 @@ UNORDERED_AUTO_TEST(empty_range_tests)
|
||||
test::check_equivalent_keys(x);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(single_item_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (single_item_tests) {
|
||||
collide_list init;
|
||||
init.push_back(collide_value(1, 1));
|
||||
|
||||
@ -99,8 +97,7 @@ UNORDERED_AUTO_TEST(single_item_tests)
|
||||
test::check_equivalent_keys(x);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(two_equivalent_item_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (two_equivalent_item_tests) {
|
||||
collide_list init;
|
||||
init.push_back(collide_value(1, 1));
|
||||
init.push_back(collide_value(1, 2));
|
||||
@ -198,23 +195,20 @@ void exhaustive_erase_tests(Container* x, int num_values, int num_duplicated)
|
||||
}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(exhaustive_collide_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (exhaustive_collide_tests) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "exhaustive_collide_tests:\n";
|
||||
collide_map m;
|
||||
exhaustive_erase_tests((collide_map*)0, 4, 4);
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n";
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(exhaustive_collide2_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (exhaustive_collide2_tests) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "exhaustive_collide2_tests:\n";
|
||||
exhaustive_erase_tests((collide_map2*)0, 8, 4);
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n";
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(exhaustive_collide3_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (exhaustive_collide3_tests) {
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "exhaustive_collide3_tests:\n";
|
||||
exhaustive_erase_tests((collide_map3*)0, 8, 4);
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n";
|
||||
|
@ -155,7 +155,7 @@ namespace find_tests {
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
UNORDERED_TEST(find_compatible_keys_test,
|
||||
((test_set)(test_multiset)(test_map)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -55,8 +55,7 @@ bool call_not_equals(
|
||||
typedef boost::unordered_map<int, int> int_map;
|
||||
typedef boost::unordered_multimap<int, int> int_multimap;
|
||||
|
||||
UNORDERED_AUTO_TEST(use_map_fwd_declared_function)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (use_map_fwd_declared_function) {
|
||||
int_map x, y;
|
||||
x[1] = 2;
|
||||
y[2] = 1;
|
||||
@ -72,8 +71,7 @@ UNORDERED_AUTO_TEST(use_map_fwd_declared_function)
|
||||
BOOST_TEST(call_not_equals(x, y));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(use_multimap_fwd_declared_function)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (use_multimap_fwd_declared_function) {
|
||||
int_multimap x, y;
|
||||
call_swap(x, y);
|
||||
BOOST_TEST(call_equals(x, y));
|
||||
|
@ -67,23 +67,20 @@ bool call_not_equals(
|
||||
typedef boost::unordered_set<int> int_set;
|
||||
typedef boost::unordered_multiset<int> int_multiset;
|
||||
|
||||
UNORDERED_AUTO_TEST(use_fwd_declared_trait_without_definition)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (use_fwd_declared_trait_without_definition) {
|
||||
BOOST_TEST(sizeof(is_unordered_set_impl((int_set*)0)) == sizeof(true_type));
|
||||
}
|
||||
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
UNORDERED_AUTO_TEST(use_fwd_declared_trait)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (use_fwd_declared_trait) {
|
||||
boost::unordered_set<int> x;
|
||||
BOOST_TEST(sizeof(is_unordered_set_impl(&x)) == sizeof(true_type));
|
||||
|
||||
BOOST_TEST(sizeof(is_unordered_set_impl((int*)0)) == sizeof(false_type));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(use_set_fwd_declared_function)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (use_set_fwd_declared_function) {
|
||||
int_set x, y;
|
||||
x.insert(1);
|
||||
y.insert(2);
|
||||
@ -99,8 +96,7 @@ UNORDERED_AUTO_TEST(use_set_fwd_declared_function)
|
||||
BOOST_TEST(call_not_equals(x, y));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(use_multiset_fwd_declared_function)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (use_multiset_fwd_declared_function) {
|
||||
int_multiset x, y;
|
||||
call_swap(x, y);
|
||||
BOOST_TEST(call_equals(x, y));
|
||||
|
@ -17,8 +17,7 @@
|
||||
#include <set>
|
||||
|
||||
namespace insert_hint {
|
||||
UNORDERED_AUTO_TEST(insert_hint_empty)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_hint_empty) {
|
||||
typedef boost::unordered_multiset<int> container;
|
||||
container x;
|
||||
x.insert(x.cbegin(), 10);
|
||||
@ -27,8 +26,7 @@ namespace insert_hint {
|
||||
test::check_equivalent_keys(x);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_hint_empty2)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_hint_empty2) {
|
||||
typedef boost::unordered_multimap<std::string, int> container;
|
||||
container x;
|
||||
x.emplace_hint(x.cbegin(), "hello", 50);
|
||||
@ -38,8 +36,7 @@ namespace insert_hint {
|
||||
test::check_equivalent_keys(x);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_hint_single)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_hint_single) {
|
||||
typedef boost::unordered_multiset<std::string> container;
|
||||
container x;
|
||||
x.insert("equal");
|
||||
@ -49,8 +46,7 @@ namespace insert_hint {
|
||||
test::check_equivalent_keys(x);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_hint_single2)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_hint_single2) {
|
||||
typedef boost::unordered_multimap<int, std::string> container;
|
||||
container x;
|
||||
x.emplace(10, "one");
|
||||
@ -69,8 +65,7 @@ namespace insert_hint {
|
||||
test::check_equivalent_keys(x);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_hint_multiple)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_hint_multiple) {
|
||||
for (unsigned int size = 0; size < 10; ++size) {
|
||||
for (unsigned int offset = 0; offset <= size; ++offset) {
|
||||
typedef boost::unordered_multiset<std::string> container;
|
||||
@ -96,8 +91,7 @@ namespace insert_hint {
|
||||
}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_hint_unique)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_hint_unique) {
|
||||
typedef boost::unordered_set<int> container;
|
||||
container x;
|
||||
x.insert(x.cbegin(), 10);
|
||||
@ -106,8 +100,7 @@ namespace insert_hint {
|
||||
test::check_equivalent_keys(x);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_hint_unique_single)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_hint_unique_single) {
|
||||
typedef boost::unordered_set<int> container;
|
||||
container x;
|
||||
x.insert(10);
|
||||
|
@ -917,11 +917,11 @@ namespace insert_tests {
|
||||
|
||||
UNORDERED_TEST(unique_insert_tests1,
|
||||
((test_set_std_alloc)(test_set)(test_map))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(equivalent_insert_tests1,
|
||||
((test_multimap_std_alloc)(test_multiset)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(insert_tests2,
|
||||
((test_multimap_std_alloc)(test_set)(test_multiset)(test_map)(
|
||||
@ -929,21 +929,21 @@ namespace insert_tests {
|
||||
|
||||
UNORDERED_TEST(unique_emplace_tests1,
|
||||
((test_set_std_alloc)(test_set)(test_map))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(equivalent_emplace_tests1,
|
||||
((test_multimap_std_alloc)(test_multiset)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(move_emplace_tests,
|
||||
((test_set_std_alloc)(test_multimap_std_alloc)(test_set)(test_map)(
|
||||
test_multiset)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(default_emplace_tests,
|
||||
((test_set_std_alloc)(test_multimap_std_alloc)(test_set)(test_map)(
|
||||
test_multiset)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(map_tests,
|
||||
((test_map))((default_generator)(generate_collisions)(limited_range)))
|
||||
@ -953,11 +953,11 @@ namespace insert_tests {
|
||||
|
||||
UNORDERED_TEST(map_insert_range_test1,
|
||||
((test_multimap_std_alloc)(test_map)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
UNORDERED_TEST(map_insert_range_test2,
|
||||
((test_multimap_std_alloc)(test_map)(test_multimap))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
|
||||
@ -976,8 +976,7 @@ namespace insert_tests {
|
||||
}
|
||||
};
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_initializer_list_set)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_initializer_list_set) {
|
||||
boost::unordered_set<int> set;
|
||||
set.insert({1, 2, 3, 1});
|
||||
BOOST_TEST_EQ(set.size(), 3u);
|
||||
@ -1015,8 +1014,7 @@ namespace insert_tests {
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1800)
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_initializer_list_multiset)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_initializer_list_multiset) {
|
||||
boost::unordered_multiset<std::string> multiset;
|
||||
// multiset.insert({});
|
||||
BOOST_TEST(multiset.empty());
|
||||
@ -1033,8 +1031,7 @@ namespace insert_tests {
|
||||
|
||||
#endif
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_initializer_list_map)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_initializer_list_map) {
|
||||
boost::unordered_map<std::string, std::string> map;
|
||||
// map.insert({});
|
||||
BOOST_TEST(map.empty());
|
||||
@ -1042,8 +1039,7 @@ namespace insert_tests {
|
||||
BOOST_TEST_EQ(map.size(), 2u);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_initializer_list_multimap)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_initializer_list_multimap) {
|
||||
boost::unordered_multimap<std::string, std::string> multimap;
|
||||
// multimap.insert({});
|
||||
BOOST_TEST(multimap.empty());
|
||||
@ -1079,8 +1075,7 @@ namespace insert_tests {
|
||||
}
|
||||
};
|
||||
|
||||
UNORDERED_AUTO_TEST(map_emplace_test)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (map_emplace_test) {
|
||||
{
|
||||
boost::unordered_map<int, overloaded_constructor, test::hash,
|
||||
test::equal_to,
|
||||
@ -1120,8 +1115,7 @@ namespace insert_tests {
|
||||
}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(set_emplace_test)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (set_emplace_test) {
|
||||
boost::unordered_set<overloaded_constructor> x;
|
||||
overloaded_constructor check;
|
||||
|
||||
@ -1169,8 +1163,7 @@ namespace insert_tests {
|
||||
}
|
||||
};
|
||||
|
||||
UNORDERED_AUTO_TEST(map_emplace_test2)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (map_emplace_test2) {
|
||||
// Emulating piecewise construction with boost::tuple bypasses the
|
||||
// allocator's construct method, but still uses test destroy method.
|
||||
test::detail::disable_construction_tracking _scoped;
|
||||
@ -1179,8 +1172,8 @@ namespace insert_tests {
|
||||
boost::unordered_map<overloaded_constructor, overloaded_constructor,
|
||||
boost::hash<overloaded_constructor>,
|
||||
std::equal_to<overloaded_constructor>,
|
||||
test::allocator1<std::pair<overloaded_constructor const,
|
||||
overloaded_constructor> > >
|
||||
test::allocator1<
|
||||
std::pair<overloaded_constructor const, overloaded_constructor> > >
|
||||
x;
|
||||
|
||||
x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(),
|
||||
@ -1246,8 +1239,8 @@ namespace insert_tests {
|
||||
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> > >
|
||||
test::allocator1<
|
||||
std::pair<overloaded_constructor const, overloaded_constructor> > >
|
||||
x;
|
||||
|
||||
x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(),
|
||||
@ -1276,8 +1269,7 @@ namespace insert_tests {
|
||||
}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(set_emplace_test2)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (set_emplace_test2) {
|
||||
boost::unordered_set<
|
||||
std::pair<overloaded_constructor, overloaded_constructor> >
|
||||
x;
|
||||
@ -1340,8 +1332,7 @@ RUN_TESTS_QUIET()
|
||||
|
||||
#else // PIECEWISE_TEST_NAME
|
||||
|
||||
UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (PIECEWISE_TEST_NAME) {
|
||||
#if EMULATING_PIECEWISE_CONSTRUCTION
|
||||
test::detail::disable_construction_tracking _scoped;
|
||||
#endif
|
||||
@ -1350,8 +1341,8 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
boost::unordered_map<overloaded_constructor, overloaded_constructor,
|
||||
boost::hash<overloaded_constructor>,
|
||||
std::equal_to<overloaded_constructor>,
|
||||
test::allocator1<std::pair<overloaded_constructor const,
|
||||
overloaded_constructor> > >
|
||||
test::allocator1<
|
||||
std::pair<overloaded_constructor const, overloaded_constructor> > >
|
||||
x;
|
||||
|
||||
x.emplace(PIECEWISE_NAMESPACE::piecewise_construct,
|
||||
@ -1400,8 +1391,8 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
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> > >
|
||||
test::allocator1<
|
||||
std::pair<overloaded_constructor const, overloaded_constructor> > >
|
||||
x;
|
||||
|
||||
x.emplace(PIECEWISE_NAMESPACE::piecewise_construct,
|
||||
@ -1431,8 +1422,7 @@ UNORDERED_AUTO_TEST(PIECEWISE_TEST_NAME)
|
||||
}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(BOOST_PP_CAT(PIECEWISE_TEST_NAME, 2))
|
||||
{
|
||||
UNORDERED_AUTO_TEST (BOOST_PP_CAT(PIECEWISE_TEST_NAME, 2)) {
|
||||
#if EMULATING_PIECEWISE_CONSTRUCTION
|
||||
test::detail::disable_construction_tracking _scoped;
|
||||
#endif
|
||||
|
@ -87,7 +87,7 @@ namespace load_factor_tests {
|
||||
|
||||
UNORDERED_TEST(load_factor_insert_tests,
|
||||
((int_set_ptr)(int_multiset_ptr)(int_map_ptr)(int_multimap_ptr))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -19,8 +19,7 @@
|
||||
|
||||
namespace merge_tests {
|
||||
|
||||
UNORDERED_AUTO_TEST(merge_set)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (merge_set) {
|
||||
boost::unordered_set<int> x;
|
||||
boost::unordered_set<int> y;
|
||||
|
||||
@ -59,8 +58,7 @@ namespace merge_tests {
|
||||
test::check_equivalent_keys(y);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(merge_multiset)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (merge_multiset) {
|
||||
boost::unordered_multiset<int> x;
|
||||
boost::unordered_multiset<int> y;
|
||||
|
||||
@ -99,8 +97,7 @@ namespace merge_tests {
|
||||
test::check_equivalent_keys(y);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(merge_set_and_multiset)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (merge_set_and_multiset) {
|
||||
boost::unordered_set<int> x;
|
||||
boost::unordered_multiset<int> y;
|
||||
|
||||
|
@ -347,26 +347,26 @@ namespace move_tests {
|
||||
test_multimap_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)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
UNORDERED_TEST(move_assign_tests1,
|
||||
((test_map_std_alloc)(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))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
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))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(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))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -16,8 +16,7 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
UNORDERED_AUTO_TEST(example1)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (example1) {
|
||||
typedef boost::unordered_map<int, std::string>::insert_return_type
|
||||
insert_return_type;
|
||||
|
||||
@ -42,8 +41,7 @@ UNORDERED_AUTO_TEST(example1)
|
||||
BOOST_TEST(r.node.mapped() == "buckle my shoe");
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(example2)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (example2) {
|
||||
boost::unordered_set<int> src;
|
||||
src.insert(1);
|
||||
src.insert(3);
|
||||
@ -58,8 +56,7 @@ UNORDERED_AUTO_TEST(example2)
|
||||
// dst == {1, 2, 3, 4, 5}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(example3)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (example3) {
|
||||
typedef boost::unordered_set<int>::iterator iterator;
|
||||
|
||||
boost::unordered_set<int> src;
|
||||
@ -90,8 +87,7 @@ UNORDERED_AUTO_TEST(example3)
|
||||
BOOST_TEST(it == dst2.end());
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(failed_insertion_with_hint)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (failed_insertion_with_hint) {
|
||||
{
|
||||
boost::unordered_set<int> src;
|
||||
boost::unordered_set<int> dst;
|
||||
@ -156,8 +152,7 @@ bool node_handle_compare(
|
||||
}
|
||||
|
||||
template <typename NodeHandle>
|
||||
bool node_handle_compare(
|
||||
NodeHandle const& nh,
|
||||
bool node_handle_compare(NodeHandle const& nh,
|
||||
std::pair<BOOST_DEDUCED_TYPENAME NodeHandle::key_type const,
|
||||
BOOST_DEDUCED_TYPENAME NodeHandle::mapped_type> const& x)
|
||||
{
|
||||
@ -235,8 +230,7 @@ template <typename Container> void node_handle_tests_impl(Container& c)
|
||||
BOOST_TEST(!n4);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(node_handle_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (node_handle_tests) {
|
||||
boost::unordered_set<int> x1;
|
||||
x1.emplace(100);
|
||||
x1.emplace(140);
|
||||
@ -364,8 +358,7 @@ struct hash_thing
|
||||
}
|
||||
};
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_node_handle_unique_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_node_handle_unique_tests) {
|
||||
{
|
||||
boost::unordered_set<int> x1;
|
||||
boost::unordered_set<int> x2;
|
||||
@ -390,8 +383,7 @@ UNORDERED_AUTO_TEST(insert_node_handle_unique_tests)
|
||||
}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_node_handle_equiv_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_node_handle_equiv_tests) {
|
||||
{
|
||||
boost::unordered_multimap<int, int, hash_thing> x1;
|
||||
boost::unordered_multimap<int, int> x2;
|
||||
@ -406,8 +398,7 @@ UNORDERED_AUTO_TEST(insert_node_handle_equiv_tests)
|
||||
}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(insert_node_handle_unique_tests2)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (insert_node_handle_unique_tests2) {
|
||||
{
|
||||
boost::unordered_set<int> x1;
|
||||
boost::unordered_set<int> x2;
|
||||
|
@ -100,8 +100,7 @@ namespace noexcept_tests {
|
||||
|
||||
bool have_is_nothrow_move = false;
|
||||
|
||||
UNORDERED_AUTO_TEST(check_is_nothrow_move)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (check_is_nothrow_move) {
|
||||
BOOST_TEST(
|
||||
!boost::is_nothrow_move_constructible<hash_possible_exception>::value);
|
||||
have_is_nothrow_move =
|
||||
@ -119,8 +118,7 @@ namespace noexcept_tests {
|
||||
#endif
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(test_noexcept)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test_noexcept) {
|
||||
if (have_is_nothrow_move) {
|
||||
BOOST_TEST((boost::is_nothrow_move_constructible<
|
||||
boost::unordered_set<int> >::value));
|
||||
@ -139,8 +137,7 @@ namespace noexcept_tests {
|
||||
boost::hash<int>, equal_to_possible_exception> >::value));
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(test_no_throw_when_noexcept)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (test_no_throw_when_noexcept) {
|
||||
typedef boost::unordered_set<int, hash_nothrow_move, equal_to_nothrow_move>
|
||||
throwing_set;
|
||||
|
||||
|
@ -208,23 +208,23 @@ namespace rehash_tests {
|
||||
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr)))
|
||||
UNORDERED_TEST(rehash_empty_test2,
|
||||
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
UNORDERED_TEST(rehash_empty_test3,
|
||||
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
UNORDERED_TEST(rehash_test1,
|
||||
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
UNORDERED_TEST(reserve_empty_test1,
|
||||
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr)))
|
||||
UNORDERED_TEST(reserve_empty_test2,
|
||||
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr)))
|
||||
UNORDERED_TEST(reserve_test1,
|
||||
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
UNORDERED_TEST(reserve_test2,
|
||||
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
@ -88,8 +88,7 @@ template <class X> void simple_test(X const& a)
|
||||
}
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(simple_tests)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (simple_tests) {
|
||||
using namespace std;
|
||||
srand(14878);
|
||||
|
||||
|
@ -187,8 +187,7 @@ namespace swap_tests {
|
||||
using test::generate_collisions;
|
||||
using test::limited_range;
|
||||
|
||||
UNORDERED_AUTO_TEST(check_traits)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (check_traits) {
|
||||
BOOST_TEST(!is_propagate(test_set));
|
||||
BOOST_TEST(is_propagate(test_set_prop_swap));
|
||||
BOOST_TEST(!is_propagate(test_set_no_prop_swap));
|
||||
@ -207,6 +206,6 @@ namespace swap_tests {
|
||||
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)))
|
||||
(default_generator)(generate_collisions)(limited_range)))
|
||||
}
|
||||
RUN_TESTS()
|
||||
|
@ -341,8 +341,7 @@ namespace unnecessary_copy_tests {
|
||||
UNORDERED_TEST(
|
||||
unnecessary_copy_emplace_boost_move_map_test, ((map)(multimap)))
|
||||
|
||||
UNORDERED_AUTO_TEST(unnecessary_copy_emplace_set_test)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (unnecessary_copy_emplace_set_test) {
|
||||
// When calling 'source' the object is moved on some compilers, but not
|
||||
// others. So count that here to adjust later.
|
||||
|
||||
@ -425,8 +424,7 @@ namespace unnecessary_copy_tests {
|
||||
MOVE_COUNT(0);
|
||||
}
|
||||
|
||||
UNORDERED_AUTO_TEST(unnecessary_copy_emplace_map_test)
|
||||
{
|
||||
UNORDERED_AUTO_TEST (unnecessary_copy_emplace_map_test) {
|
||||
// When calling 'source' the object is moved on some compilers, but not
|
||||
// others. So count that here to adjust later.
|
||||
|
||||
|
Reference in New Issue
Block a user