Rename methods to be different for unique/equiv keys

So that the implementation can be moved into a single class. Still some
other methods to rename. Some methods didn't need to be renamed (e.g.
try_emplace is only used with unique keys), but still renamed for
consistency.
This commit is contained in:
Daniel James
2017-04-24 09:46:05 +01:00
parent 8229aa6b3c
commit 77bf2b5e33
3 changed files with 229 additions and 214 deletions

View File

@ -3624,7 +3624,7 @@ template <typename N> struct node_algo
// Add node 'n' after 'pos'.
// This results in a different order to the grouped implementation.
static inline void add_to_node_group(node_pointer n, node_pointer pos)
static inline void add_to_node(node_pointer n, node_pointer pos)
{
n->next_ = pos->next_;
pos->next_ = n;
@ -3761,7 +3761,7 @@ struct table_unique : boost::unordered::detail::table<Types>
// equals
bool equals(table_unique const& other) const
bool equals_unique(table const& other) const
{
if (this->size_ != other.size_)
return false;
@ -3779,7 +3779,7 @@ struct table_unique : boost::unordered::detail::table<Types>
// Emplace/Insert
inline node_pointer add_node(node_pointer n, std::size_t key_hash)
inline node_pointer add_node_unique(node_pointer n, std::size_t key_hash)
{
n->hash_ = key_hash;
@ -3806,27 +3806,28 @@ struct table_unique : boost::unordered::detail::table<Types>
return n;
}
inline node_pointer resize_and_add_node(
inline node_pointer resize_and_add_node_unique(
node_pointer n, std::size_t key_hash)
{
node_tmp b(n, this->node_alloc());
this->reserve_for_insert(this->size_ + 1);
return this->add_node(b.release(), key_hash);
return this->add_node_unique(b.release(), key_hash);
}
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
iterator emplace_hint_impl(
iterator emplace_hint_unique(
c_iterator hint, const_key_type& k, BOOST_UNORDERED_EMPLACE_ARGS)
{
if (hint.node_ && this->key_eq()(k, this->get_key(hint.node_))) {
return iterator(hint.node_);
} else {
return emplace_impl(k, BOOST_UNORDERED_EMPLACE_FORWARD).first;
return emplace_unique(k, BOOST_UNORDERED_EMPLACE_FORWARD).first;
}
}
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
emplace_return emplace_impl(const_key_type& k, BOOST_UNORDERED_EMPLACE_ARGS)
emplace_return emplace_unique(
const_key_type& k, BOOST_UNORDERED_EMPLACE_ARGS)
{
std::size_t key_hash = this->hash(k);
node_pointer pos = this->find_node(key_hash, k);
@ -3834,7 +3835,7 @@ struct table_unique : boost::unordered::detail::table<Types>
return emplace_return(iterator(pos), false);
} else {
return emplace_return(
iterator(this->resize_and_add_node(
iterator(this->resize_and_add_node_unique(
boost::unordered::detail::func::construct_node_from_args(
this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD),
key_hash)),
@ -3843,7 +3844,7 @@ struct table_unique : boost::unordered::detail::table<Types>
}
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
iterator emplace_hint_impl(
iterator emplace_hint_unique(
c_iterator hint, no_key, BOOST_UNORDERED_EMPLACE_ARGS)
{
node_tmp b(boost::unordered::detail::func::construct_node_from_args(
@ -3858,12 +3859,13 @@ struct table_unique : boost::unordered::detail::table<Types>
if (pos) {
return iterator(pos);
} else {
return iterator(this->resize_and_add_node(b.release(), key_hash));
return iterator(
this->resize_and_add_node_unique(b.release(), key_hash));
}
}
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
emplace_return emplace_impl(no_key, BOOST_UNORDERED_EMPLACE_ARGS)
emplace_return emplace_unique(no_key, BOOST_UNORDERED_EMPLACE_ARGS)
{
node_tmp b(boost::unordered::detail::func::construct_node_from_args(
this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD),
@ -3874,14 +3876,14 @@ struct table_unique : boost::unordered::detail::table<Types>
if (pos) {
return emplace_return(iterator(pos), false);
} else {
return emplace_return(
iterator(this->resize_and_add_node(b.release(), key_hash)),
return emplace_return(iterator(this->resize_and_add_node_unique(
b.release(), key_hash)),
true);
}
}
template <typename Key>
emplace_return try_emplace_impl(BOOST_FWD_REF(Key) k)
emplace_return try_emplace_unique(BOOST_FWD_REF(Key) k)
{
std::size_t key_hash = this->hash(k);
node_pointer pos = this->find_node(key_hash, k);
@ -3889,7 +3891,7 @@ struct table_unique : boost::unordered::detail::table<Types>
return emplace_return(iterator(pos), false);
} else {
return emplace_return(
iterator(this->resize_and_add_node(
iterator(this->resize_and_add_node_unique(
boost::unordered::detail::func::construct_node_pair(
this->node_alloc(), boost::forward<Key>(k)),
key_hash)),
@ -3898,17 +3900,17 @@ struct table_unique : boost::unordered::detail::table<Types>
}
template <typename Key>
iterator try_emplace_hint_impl(c_iterator hint, BOOST_FWD_REF(Key) k)
iterator try_emplace_hint_unique(c_iterator hint, BOOST_FWD_REF(Key) k)
{
if (hint.node_ && this->key_eq()(hint->first, k)) {
return iterator(hint.node_);
} else {
return try_emplace_impl(k).first;
return try_emplace_unique(k).first;
}
}
template <typename Key, BOOST_UNORDERED_EMPLACE_TEMPLATE>
emplace_return try_emplace_impl(
emplace_return try_emplace_unique(
BOOST_FWD_REF(Key) k, BOOST_UNORDERED_EMPLACE_ARGS)
{
std::size_t key_hash = this->hash(k);
@ -3917,7 +3919,7 @@ struct table_unique : boost::unordered::detail::table<Types>
return emplace_return(iterator(pos), false);
} else {
return emplace_return(
iterator(this->resize_and_add_node(
iterator(this->resize_and_add_node_unique(
boost::unordered::detail::func::
construct_node_pair_from_args(this->node_alloc(),
boost::forward<Key>(k),
@ -3928,18 +3930,18 @@ struct table_unique : boost::unordered::detail::table<Types>
}
template <typename Key, BOOST_UNORDERED_EMPLACE_TEMPLATE>
iterator try_emplace_hint_impl(
iterator try_emplace_hint_unique(
c_iterator hint, BOOST_FWD_REF(Key) k, BOOST_UNORDERED_EMPLACE_ARGS)
{
if (hint.node_ && this->key_eq()(hint->first, k)) {
return iterator(hint.node_);
} else {
return try_emplace_impl(k, BOOST_UNORDERED_EMPLACE_FORWARD).first;
return try_emplace_unique(k, BOOST_UNORDERED_EMPLACE_FORWARD).first;
}
}
template <typename Key, typename M>
emplace_return insert_or_assign_impl(
emplace_return insert_or_assign_unique(
BOOST_FWD_REF(Key) k, BOOST_FWD_REF(M) obj)
{
std::size_t key_hash = this->hash(k);
@ -3950,7 +3952,7 @@ struct table_unique : boost::unordered::detail::table<Types>
return emplace_return(iterator(pos), false);
} else {
return emplace_return(
iterator(this->resize_and_add_node(
iterator(this->resize_and_add_node_unique(
boost::unordered::detail::func::construct_node_pair(
this->node_alloc(), boost::forward<Key>(k),
boost::forward<M>(obj)),
@ -3960,7 +3962,7 @@ struct table_unique : boost::unordered::detail::table<Types>
}
template <typename NodeType, typename InsertReturnType>
void move_insert_node_type(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_);
@ -3972,7 +3974,8 @@ struct table_unique : boost::unordered::detail::table<Types>
result.position = iterator(pos);
} else {
this->reserve_for_insert(this->size_ + 1);
result.position = iterator(this->add_node(np.ptr_, key_hash));
result.position =
iterator(this->add_node_unique(np.ptr_, key_hash));
result.inserted = true;
np.ptr_ = node_pointer();
}
@ -3980,7 +3983,8 @@ struct table_unique : boost::unordered::detail::table<Types>
}
template <typename NodeType>
iterator move_insert_node_type_with_hint(c_iterator hint, NodeType& np)
iterator move_insert_node_type_with_hint_unique(
c_iterator hint, NodeType& np)
{
if (!np) {
return iterator();
@ -3993,14 +3997,14 @@ struct table_unique : boost::unordered::detail::table<Types>
node_pointer pos = this->find_node(key_hash, k);
if (!pos) {
this->reserve_for_insert(this->size_ + 1);
pos = this->add_node(np.ptr_, key_hash);
pos = this->add_node_unique(np.ptr_, key_hash);
np.ptr_ = node_pointer();
}
return iterator(pos);
}
template <typename Types2>
void merge_impl(boost::unordered::detail::table<Types2>& other)
void merge_unique(boost::unordered::detail::table<Types2>& other)
{
typedef boost::unordered::detail::table<Types2> other_table;
BOOST_STATIC_ASSERT(
@ -4025,7 +4029,7 @@ struct table_unique : boost::unordered::detail::table<Types>
prev->next_ = n->next_;
--other.size_;
other.fix_bucket(other.hash_to_bucket(n->hash_), prev);
this->add_node(n, key_hash);
this->add_node_unique(n, key_hash);
}
}
}
@ -4038,20 +4042,20 @@ struct table_unique : boost::unordered::detail::table<Types>
// safety strong otherwise
template <class InputIt>
void insert_range_impl(const_key_type& k, InputIt i, InputIt j)
void insert_range_unique(const_key_type& k, InputIt i, InputIt j)
{
insert_range_impl2(k, i, j);
insert_range_unique2(k, i, j);
while (++i != j) {
// Note: can't use get_key as '*i' might not be value_type - it
// could be a pair with first_types as key_type without const or
// a different second_type.
insert_range_impl2(extractor::extract(*i), i, j);
insert_range_unique2(extractor::extract(*i), i, j);
}
}
template <class InputIt>
void insert_range_impl2(const_key_type& k, InputIt i, InputIt j)
void insert_range_unique2(const_key_type& k, InputIt i, InputIt j)
{
// No side effects in this initial code
std::size_t key_hash = this->hash(k);
@ -4064,12 +4068,12 @@ struct table_unique : boost::unordered::detail::table<Types>
if (this->size_ + 1 > this->max_load_)
this->reserve_for_insert(
this->size_ + boost::unordered::detail::insert_size(i, j));
this->add_node(b.release(), key_hash);
this->add_node_unique(b.release(), key_hash);
}
}
template <class InputIt>
void insert_range_impl(no_key, InputIt i, InputIt j)
void insert_range_unique(no_key, InputIt i, InputIt j)
{
node_constructor a(this->node_alloc());
@ -4091,7 +4095,7 @@ struct table_unique : boost::unordered::detail::table<Types>
// reserve has basic exception safety if the hash function
// throws, strong otherwise.
this->reserve_for_insert(this->size_ + 1);
this->add_node(b.release(), key_hash);
this->add_node_unique(b.release(), key_hash);
}
} while (++i != j);
}
@ -4099,7 +4103,7 @@ struct table_unique : boost::unordered::detail::table<Types>
////////////////////////////////////////////////////////////////////////
// Extract
inline node_pointer extract_by_iterator(c_iterator i)
inline node_pointer extract_by_iterator_unique(c_iterator i)
{
node_pointer n = i.node_;
BOOST_ASSERT(n);
@ -4121,7 +4125,7 @@ struct table_unique : boost::unordered::detail::table<Types>
//
// no throw
std::size_t erase_key(const_key_type& k)
std::size_t erase_key_unique(const_key_type& k)
{
if (!this->size_)
return 0;
@ -4136,7 +4140,7 @@ struct table_unique : boost::unordered::detail::table<Types>
return 1;
}
void erase_nodes(node_pointer i, node_pointer j)
void erase_nodes_unique(node_pointer i, node_pointer j)
{
std::size_t bucket_index = this->hash_to_bucket(i->hash_);
@ -4153,15 +4157,16 @@ struct table_unique : boost::unordered::detail::table<Types>
}
////////////////////////////////////////////////////////////////////////
// fill_buckets
// fill_buckets_unique
void copy_buckets(table const& src)
{
this->create_buckets(this->bucket_count_);
for (node_pointer n = src.begin(); n; n = node_algo::next_node(n)) {
this->add_node(boost::unordered::detail::func::construct_node(
this->node_alloc(), n->value()),
this->add_node_unique(
boost::unordered::detail::func::construct_node(
this->node_alloc(), n->value()),
n->hash_);
}
}
@ -4171,8 +4176,9 @@ struct table_unique : boost::unordered::detail::table<Types>
this->create_buckets(this->bucket_count_);
for (node_pointer n = src.begin(); n; n = node_algo::next_node(n)) {
this->add_node(boost::unordered::detail::func::construct_node(
this->node_alloc(), boost::move(n->value())),
this->add_node_unique(
boost::unordered::detail::func::construct_node(
this->node_alloc(), boost::move(n->value())),
n->hash_);
}
}
@ -4181,7 +4187,7 @@ struct table_unique : boost::unordered::detail::table<Types>
{
node_holder<node_allocator> holder(*this);
for (node_pointer n = src.begin(); n; n = node_algo::next_node(n)) {
this->add_node(holder.copy_of(n->value()), n->hash_);
this->add_node_unique(holder.copy_of(n->value()), n->hash_);
}
}
@ -4189,7 +4195,7 @@ struct table_unique : boost::unordered::detail::table<Types>
{
node_holder<node_allocator> holder(*this);
for (node_pointer n = src.begin(); n; n = node_algo::next_node(n)) {
this->add_node(holder.move_copy_of(n->value()), n->hash_);
this->add_node_unique(holder.move_copy_of(n->value()), n->hash_);
}
}
};
@ -4297,7 +4303,7 @@ template <typename N> struct grouped_node_algo
// If 'pos' is the first node in group, add to the end of the group,
// otherwise add before 'pos'. Other versions will probably behave
// differently.
static inline void add_to_node_group(node_pointer n, node_pointer pos)
static inline void add_to_node(node_pointer n, node_pointer pos)
{
n->next_ = pos->group_prev_->next_;
n->group_prev_ = pos->group_prev_;
@ -4458,13 +4464,13 @@ struct table_equiv : boost::unordered::detail::table<Types>
this->move_buckets_from(x);
} else if (x.size_) {
// TODO: Could pick new bucket size?
this->move_buckets(x);
this->move_buckets_equiv(x);
}
}
// Equality
bool equals(table_equiv const& other) const
bool equals_equiv(table const& other) const
{
if (this->size_ != other.size_)
return false;
@ -4475,7 +4481,7 @@ struct table_equiv : boost::unordered::detail::table<Types>
return false;
node_pointer end1 = node_algo::next_group(n1, this);
node_pointer end2 = node_algo::next_group(n2, this);
if (!group_equals(n1, end1, n2, end2))
if (!group_equals_equiv(n1, end1, n2, end2))
return false;
n1 = end1;
}
@ -4483,7 +4489,7 @@ struct table_equiv : boost::unordered::detail::table<Types>
return true;
}
static bool group_equals(
static bool group_equals_equiv(
node_pointer n1, node_pointer end1, node_pointer n2, node_pointer end2)
{
for (;;) {
@ -4517,12 +4523,12 @@ struct table_equiv : boost::unordered::detail::table<Types>
node_pointer start = n1;
for (; n1 != end1; n1 = node_algo::next_node(n1)) {
value_type const& v = n1->value();
if (!find(start, n1, v)) {
std::size_t matches = count_equal(n2, end2, v);
if (!find_equiv(start, n1, v)) {
std::size_t matches = count_equal_equiv(n2, end2, v);
if (!matches)
return false;
if (matches !=
1 + count_equal(node_algo::next_node(n1), end1, v))
1 + count_equal_equiv(node_algo::next_node(n1), end1, v))
return false;
}
}
@ -4530,7 +4536,8 @@ struct table_equiv : boost::unordered::detail::table<Types>
return true;
}
static bool find(node_pointer n, node_pointer end, value_type const& v)
static bool find_equiv(
node_pointer n, node_pointer end, value_type const& v)
{
for (; n != end; n = node_algo::next_node(n))
if (n->value() == v)
@ -4538,7 +4545,7 @@ struct table_equiv : boost::unordered::detail::table<Types>
return false;
}
static std::size_t count_equal(
static std::size_t count_equal_equiv(
node_pointer n, node_pointer end, value_type const& v)
{
std::size_t count = 0;
@ -4550,12 +4557,12 @@ struct table_equiv : boost::unordered::detail::table<Types>
// Emplace/Insert
inline node_pointer add_node(
inline node_pointer add_node_equiv(
node_pointer n, std::size_t key_hash, node_pointer pos)
{
n->hash_ = key_hash;
if (pos) {
node_algo::add_to_node_group(n, pos);
node_algo::add_to_node(n, pos);
if (n->next_) {
std::size_t next_bucket =
this->hash_to_bucket(node_algo::next_node(n)->hash_);
@ -4588,10 +4595,10 @@ struct table_equiv : boost::unordered::detail::table<Types>
return n;
}
inline node_pointer add_using_hint(node_pointer n, node_pointer hint)
inline node_pointer add_using_hint_equiv(node_pointer n, node_pointer hint)
{
n->hash_ = hint->hash_;
node_algo::add_to_node_group(n, hint);
node_algo::add_to_node(n, hint);
if (n->next_ != hint && n->next_) {
std::size_t next_bucket =
this->hash_to_bucket(node_algo::next_node(n)->hash_);
@ -4603,41 +4610,44 @@ struct table_equiv : boost::unordered::detail::table<Types>
return n;
}
iterator emplace_impl(node_pointer n)
iterator emplace_equiv(node_pointer n)
{
node_tmp a(n, this->node_alloc());
const_key_type& k = this->get_key(a.node_);
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(a.release(), key_hash, position));
return iterator(this->add_node_equiv(a.release(), key_hash, position));
}
iterator emplace_hint_impl(c_iterator hint, node_pointer n)
iterator emplace_hint_equiv(c_iterator hint, node_pointer n)
{
node_tmp a(n, this->node_alloc());
const_key_type& k = this->get_key(a.node_);
if (hint.node_ && this->key_eq()(k, this->get_key(hint.node_))) {
this->reserve_for_insert(this->size_ + 1);
return iterator(this->add_using_hint(a.release(), hint.node_));
return iterator(
this->add_using_hint_equiv(a.release(), hint.node_));
} else {
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(a.release(), key_hash, position));
return iterator(
this->add_node_equiv(a.release(), key_hash, position));
}
}
void emplace_impl_no_rehash(node_pointer n)
void emplace_no_rehash_equiv(node_pointer n)
{
node_tmp a(n, this->node_alloc());
const_key_type& k = this->get_key(a.node_);
std::size_t key_hash = this->hash(k);
node_pointer position = this->find_node(key_hash, k);
this->add_node(a.release(), key_hash, position);
this->add_node_equiv(a.release(), key_hash, position);
}
template <typename NodeType> iterator move_insert_node_type(NodeType& np)
template <typename NodeType>
iterator move_insert_node_type_equiv(NodeType& np)
{
iterator result;
@ -4646,7 +4656,7 @@ struct table_equiv : boost::unordered::detail::table<Types>
std::size_t key_hash = this->hash(k);
node_pointer pos = this->find_node(key_hash, k);
this->reserve_for_insert(this->size_ + 1);
result = iterator(this->add_node(np.ptr_, key_hash, pos));
result = iterator(this->add_node_equiv(np.ptr_, key_hash, pos));
np.ptr_ = node_pointer();
}
@ -4654,7 +4664,8 @@ struct table_equiv : boost::unordered::detail::table<Types>
}
template <typename NodeType>
iterator move_insert_node_type_with_hint(c_iterator hint, NodeType& np)
iterator move_insert_node_type_with_hint_equiv(
c_iterator hint, NodeType& np)
{
iterator result;
@ -4663,12 +4674,13 @@ struct table_equiv : boost::unordered::detail::table<Types>
if (hint.node_ && this->key_eq()(k, this->get_key(hint.node_))) {
this->reserve_for_insert(this->size_ + 1);
result = iterator(this->add_using_hint(np.ptr_, hint.node_));
result =
iterator(this->add_using_hint_equiv(np.ptr_, hint.node_));
} else {
std::size_t key_hash = this->hash(k);
node_pointer pos = this->find_node(key_hash, k);
this->reserve_for_insert(this->size_ + 1);
result = iterator(this->add_node(np.ptr_, key_hash, pos));
result = iterator(this->add_node_equiv(np.ptr_, key_hash, pos));
}
np.ptr_ = node_pointer();
}
@ -4682,7 +4694,7 @@ struct table_equiv : boost::unordered::detail::table<Types>
// if hash function throws, or inserting > 1 element, basic exception
// safety. Strong otherwise
template <class I>
void insert_range(I i, I j,
void insert_range_equiv(I i, I j,
typename boost::unordered::detail::enable_if_forward<I, void*>::type =
0)
{
@ -4691,14 +4703,14 @@ struct table_equiv : boost::unordered::detail::table<Types>
std::size_t distance = static_cast<std::size_t>(std::distance(i, j));
if (distance == 1) {
emplace_impl(boost::unordered::detail::func::construct_node(
emplace_equiv(boost::unordered::detail::func::construct_node(
this->node_alloc(), *i));
} else {
// Only require basic exception safety here
this->reserve_for_insert(this->size_ + distance);
for (; i != j; ++i) {
emplace_impl_no_rehash(
emplace_no_rehash_equiv(
boost::unordered::detail::func::construct_node(
this->node_alloc(), *i));
}
@ -4706,12 +4718,12 @@ struct table_equiv : boost::unordered::detail::table<Types>
}
template <class I>
void insert_range(I i, I j,
void insert_range_equiv(I i, I j,
typename boost::unordered::detail::disable_if_forward<I, void*>::type =
0)
{
for (; i != j; ++i) {
emplace_impl(boost::unordered::detail::func::construct_node(
emplace_equiv(boost::unordered::detail::func::construct_node(
this->node_alloc(), *i));
}
}
@ -4719,7 +4731,7 @@ struct table_equiv : boost::unordered::detail::table<Types>
////////////////////////////////////////////////////////////////////////
// Extract
inline node_pointer extract_by_iterator(c_iterator n)
inline node_pointer extract_by_iterator_equiv(c_iterator n)
{
node_pointer i = n.node_;
BOOST_ASSERT(i);
@ -4753,7 +4765,7 @@ struct table_equiv : boost::unordered::detail::table<Types>
//
// no throw
std::size_t erase_key(const_key_type& k)
std::size_t erase_key_equiv(const_key_type& k)
{
if (!this->size_)
return 0;
@ -4772,7 +4784,7 @@ struct table_equiv : boost::unordered::detail::table<Types>
return deleted_count;
}
link_pointer erase_nodes(node_pointer i, node_pointer j)
link_pointer erase_nodes_equiv(node_pointer i, node_pointer j)
{
std::size_t bucket_index = this->hash_to_bucket(i->hash_);
@ -4811,34 +4823,36 @@ struct table_equiv : boost::unordered::detail::table<Types>
for (node_pointer n = src.begin(); n;) {
std::size_t key_hash = n->hash_;
node_pointer group_end(node_algo::next_group(n, this));
node_pointer pos =
this->add_node(boost::unordered::detail::func::construct_node(
this->node_alloc(), n->value()),
key_hash, node_pointer());
node_pointer pos = this->add_node_equiv(
boost::unordered::detail::func::construct_node(
this->node_alloc(), n->value()),
key_hash, node_pointer());
for (n = node_algo::next_node(n); n != group_end;
n = node_algo::next_node(n)) {
this->add_node(boost::unordered::detail::func::construct_node(
this->node_alloc(), n->value()),
this->add_node_equiv(
boost::unordered::detail::func::construct_node(
this->node_alloc(), n->value()),
key_hash, pos);
}
}
}
void move_buckets(table const& src)
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 = n->hash_;
node_pointer group_end(node_algo::next_group(n, this));
node_pointer pos =
this->add_node(boost::unordered::detail::func::construct_node(
this->node_alloc(), boost::move(n->value())),
key_hash, node_pointer());
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 = node_algo::next_node(n); n != group_end;
n = node_algo::next_node(n)) {
this->add_node(boost::unordered::detail::func::construct_node(
this->node_alloc(), boost::move(n->value())),
this->add_node_equiv(
boost::unordered::detail::func::construct_node(
this->node_alloc(), boost::move(n->value())),
key_hash, pos);
}
}
@ -4850,11 +4864,11 @@ struct table_equiv : boost::unordered::detail::table<Types>
for (node_pointer n = src.begin(); n;) {
std::size_t key_hash = n->hash_;
node_pointer group_end(node_algo::next_group(n, this));
node_pointer pos = this->add_node(
node_pointer pos = this->add_node_equiv(
holder.copy_of(n->value()), key_hash, node_pointer());
for (n = node_algo::next_node(n); n != group_end;
n = node_algo::next_node(n)) {
this->add_node(holder.copy_of(n->value()), key_hash, pos);
this->add_node_equiv(holder.copy_of(n->value()), key_hash, pos);
}
}
}
@ -4865,11 +4879,12 @@ struct table_equiv : boost::unordered::detail::table<Types>
for (node_pointer n = src.begin(); n;) {
std::size_t key_hash = n->hash_;
node_pointer group_end(node_algo::next_group(n, this));
node_pointer pos = this->add_node(
node_pointer pos = this->add_node_equiv(
holder.move_copy_of(n->value()), key_hash, node_pointer());
for (n = node_algo::next_node(n); n != group_end;
n = node_algo::next_node(n)) {
this->add_node(holder.move_copy_of(n->value()), key_hash, pos);
this->add_node_equiv(
holder.move_copy_of(n->value()), key_hash, pos);
}
}
}

View File

@ -222,7 +222,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
template <class... Args>
std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
{
return table_.emplace_impl(
return table_.emplace_unique(
table::extractor::extract(boost::forward<Args>(args)...),
boost::forward<Args>(args)...);
}
@ -248,7 +248,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
template <typename A0>
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
{
return table_.emplace_impl(
return table_.emplace_unique(
table::extractor::extract(boost::forward<A0>(a0)),
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0)));
@ -258,7 +258,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> emplace(
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return table_.emplace_impl(
return table_.emplace_unique(
table::extractor::extract(
boost::forward<A0>(a0), boost::forward<A1>(a1)),
boost::unordered::detail::create_emplace_args(
@ -269,7 +269,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> emplace(
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
{
return table_.emplace_impl(
return table_.emplace_unique(
table::extractor::extract(
boost::forward<A0>(a0), boost::forward<A1>(a1)),
boost::unordered::detail::create_emplace_args(
@ -284,7 +284,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
template <class... Args>
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
return table_.emplace_hint_impl(hint,
return table_.emplace_hint_unique(hint,
table::extractor::extract(boost::forward<Args>(args)...),
boost::forward<Args>(args)...);
}
@ -306,17 +306,17 @@ template <class K, class T, class H, class P, class A> class unordered_map
template <typename A0>
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
{
return table_.emplace_hint_impl(hint,
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>
iterator emplace_hint(
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return table_.emplace_hint_impl(
return table_.emplace_hint_unique(
hint, table::extractor::extract(
boost::forward<A0>(a0), boost::forward<A1>(a1)),
boost::unordered::detail::create_emplace_args(
@ -327,7 +327,7 @@ 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, BOOST_FWD_REF(A2) a2)
{
return table_.emplace_hint_impl(
return table_.emplace_hint_unique(
hint, table::extractor::extract(
boost::forward<A0>(a0), boost::forward<A1>(a1)),
boost::unordered::detail::create_emplace_args(
@ -344,7 +344,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> emplace( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return table_.emplace_impl( \
return table_.emplace_unique( \
table::extractor::extract( \
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
boost::unordered::detail::create_emplace_args( \
@ -355,7 +355,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
iterator emplace_hint(const_iterator hint, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return table_.emplace_hint_impl( \
return table_.emplace_hint_unique( \
hint, table::extractor::extract( \
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
boost::unordered::detail::create_emplace_args( \
@ -424,7 +424,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
node_type extract(const_iterator position)
{
return node_type(
table_.extract_by_iterator(position), table_.node_alloc());
table_.extract_by_iterator_unique(position), table_.node_alloc());
}
node_type extract(const key_type& k)
@ -435,13 +435,13 @@ template <class K, class T, class H, class P, class A> class unordered_map
insert_return_type insert(BOOST_RV_REF(node_type) np)
{
insert_return_type result;
table_.move_insert_node_type(np, result);
table_.move_insert_node_type_unique(np, result);
return boost::move(result);
}
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
{
return table_.move_insert_node_type_with_hint(hint, np);
return table_.move_insert_node_type_with_hint_unique(hint, np);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -459,14 +459,14 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> try_emplace(
key_type const& k, BOOST_FWD_REF(Args)... args)
{
return table_.try_emplace_impl(k, boost::forward<Args>(args)...);
return table_.try_emplace_unique(k, boost::forward<Args>(args)...);
}
template <class... Args>
iterator try_emplace(
const_iterator hint, key_type const& k, BOOST_FWD_REF(Args)... args)
{
return table_.try_emplace_hint_impl(
return table_.try_emplace_hint_unique(
hint, k, boost::forward<Args>(args)...);
}
@ -474,7 +474,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> try_emplace(
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args)
{
return table_.try_emplace_impl(
return table_.try_emplace_unique(
boost::move(k), boost::forward<Args>(args)...);
}
@ -482,7 +482,7 @@ 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(Args)... args)
{
return table_.try_emplace_hint_impl(
return table_.try_emplace_hint_unique(
hint, boost::move(k), boost::forward<Args>(args)...);
}
@ -491,20 +491,20 @@ template <class K, class T, class H, class P, class A> class unordered_map
template <typename Key>
std::pair<iterator, bool> try_emplace(BOOST_FWD_REF(Key) k)
{
return table_.try_emplace_impl(boost::forward<Key>(k));
return table_.try_emplace_unique(boost::forward<Key>(k));
}
template <typename Key>
iterator try_emplace(const_iterator hint, BOOST_FWD_REF(Key) k)
{
return table_.try_emplace_hint_impl(hint, boost::forward<Key>(k));
return table_.try_emplace_hint_unique(hint, boost::forward<Key>(k));
}
template <typename A0>
std::pair<iterator, bool> try_emplace(
key_type const& k, BOOST_FWD_REF(A0) a0)
{
return table_.try_emplace_impl(
return table_.try_emplace_unique(
k, boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0)));
}
@ -513,7 +513,7 @@ 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_FWD_REF(A0) a0)
{
return table_.try_emplace_hint_impl(
return table_.try_emplace_hint_unique(
hint, k, boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0)));
}
@ -522,7 +522,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> try_emplace(
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0)
{
return table_.try_emplace_impl(
return table_.try_emplace_hint_unique(
boost::move(k), boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0)));
}
@ -531,7 +531,7 @@ 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)
{
return table_.try_emplace_hint_impl(
return table_.try_emplace_hint_unique(
hint, boost::move(k), boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0)));
}
@ -540,7 +540,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> try_emplace(
key_type const& k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return table_.try_emplace_impl(
return table_.try_emplace_unique(
k, boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0), boost::forward<A1>(a1)));
}
@ -549,7 +549,7 @@ 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_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return table_.try_emplace_hint_impl(
return table_.try_emplace_hint_unique(
hint, k, boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0), boost::forward<A1>(a1)));
}
@ -558,7 +558,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> try_emplace(
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return table_.try_emplace_impl(
return table_.try_emplace_unique(
boost::move(k),
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0), boost::forward<A1>(a1)));
@ -568,7 +568,7 @@ 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_impl(
return table_.try_emplace_hint_unique(
hint, boost::move(k),
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0), boost::forward<A1>(a1)));
@ -578,7 +578,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
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_impl(
return table_.try_emplace_unique(
k, boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0), boost::forward<A1>(a1),
boost::forward<A2>(a2)));
@ -589,7 +589,7 @@ 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_impl_(
.try_emplace_unique(
hint, k, boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0), boost::forward<A1>(a1),
boost::forward<A2>(a2)))
@ -600,7 +600,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
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_impl(
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)));
@ -610,7 +610,7 @@ 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, BOOST_FWD_REF(A2) a2)
{
return table_.try_emplace_hint_impl(
return table_.try_emplace_hint_unique(
hint, boost::move(k),
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0), boost::forward<A1>(a1),
@ -623,7 +623,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> try_emplace( \
key_type const& k, BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return table_.try_emplace_impl( \
return table_.try_emplace_unique( \
k, boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \
} \
@ -632,7 +632,7 @@ 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_impl(hint, k, \
return table_.try_emplace_hint_unique(hint, k, \
boost::unordered::detail::create_emplace_args(BOOST_PP_ENUM_##z( \
n, BOOST_UNORDERED_CALL_FORWARD, a))); \
} \
@ -641,7 +641,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> try_emplace(BOOST_RV_REF(key_type) k, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return table_.try_emplace_impl(boost::move(k), \
return table_.try_emplace_unique(boost::move(k), \
boost::unordered::detail::create_emplace_args(BOOST_PP_ENUM_##z( \
n, BOOST_UNORDERED_CALL_FORWARD, a))); \
} \
@ -650,7 +650,7 @@ 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_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return table_.try_emplace_hint_impl(hint, boost::move(k), \
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))); \
}
@ -666,14 +666,14 @@ template <class K, class T, class H, class P, class A> class unordered_map
std::pair<iterator, bool> insert_or_assign(
key_type const& k, BOOST_FWD_REF(M) obj)
{
return table_.insert_or_assign_impl(k, boost::forward<M>(obj));
return table_.insert_or_assign_unique(k, boost::forward<M>(obj));
}
template <class M>
std::pair<iterator, bool> insert_or_assign(
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
{
return table_.insert_or_assign_impl(
return table_.insert_or_assign_unique(
boost::move(k), boost::forward<M>(obj));
}
@ -681,7 +681,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
iterator insert_or_assign(
const_iterator, key_type const& k, BOOST_FWD_REF(M) obj)
{
return table_.insert_or_assign_impl(k, boost::forward<M>(obj)).first;
return table_.insert_or_assign_unique(k, boost::forward<M>(obj)).first;
}
template <class M>
@ -689,7 +689,7 @@ template <class K, class T, class H, class P, class A> class unordered_map
const_iterator, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
{
return table_
.insert_or_assign_impl(boost::move(k), boost::forward<M>(obj))
.insert_or_assign_unique(boost::move(k), boost::forward<M>(obj))
.first;
}
@ -1004,7 +1004,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
template <class... Args> iterator emplace(BOOST_FWD_REF(Args)... args)
{
return iterator(table_.emplace_impl(
return iterator(table_.emplace_equiv(
boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(), boost::forward<Args>(args)...)));
}
@ -1028,7 +1028,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
template <typename A0> iterator emplace(BOOST_FWD_REF(A0) a0)
{
return iterator(table_.emplace_impl(
return iterator(table_.emplace_equiv(
boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -1038,7 +1038,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
template <typename A0, typename A1>
iterator emplace(BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return iterator(table_.emplace_impl(
return iterator(table_.emplace_equiv(
boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -1049,7 +1049,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
iterator emplace(
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
{
return iterator(table_.emplace_impl(
return iterator(table_.emplace_equiv(
boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -1064,7 +1064,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
template <class... Args>
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
return iterator(table_.emplace_hint_impl(
return iterator(table_.emplace_hint_equiv(
hint, boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(), boost::forward<Args>(args)...)));
}
@ -1086,7 +1086,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
template <typename A0>
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
{
return iterator(table_.emplace_hint_impl(
return iterator(table_.emplace_hint_equiv(
hint, boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -1097,7 +1097,7 @@ 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, BOOST_FWD_REF(A1) a1)
{
return iterator(table_.emplace_hint_impl(
return iterator(table_.emplace_hint_equiv(
hint, boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -1108,7 +1108,7 @@ 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,
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
{
return iterator(table_.emplace_hint_impl(
return iterator(table_.emplace_hint_equiv(
hint, boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -1124,7 +1124,7 @@ 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(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return iterator(table_.emplace_impl( \
return iterator(table_.emplace_equiv( \
boost::unordered::detail::func::construct_node_from_args( \
table_.node_alloc(), \
boost::unordered::detail::create_emplace_args( \
@ -1135,7 +1135,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
iterator emplace_hint(const_iterator hint, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return iterator(table_.emplace_hint_impl( \
return iterator(table_.emplace_hint_equiv( \
hint, \
boost::unordered::detail::func::construct_node_from_args( \
table_.node_alloc(), \
@ -1202,7 +1202,7 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
node_type extract(const_iterator position)
{
return node_type(
table_.extract_by_iterator(position), table_.node_alloc());
table_.extract_by_iterator_equiv(position), table_.node_alloc());
}
node_type extract(const key_type& k)
@ -1212,12 +1212,12 @@ template <class K, class T, class H, class P, class A> class unordered_multimap
iterator insert(BOOST_RV_REF(node_type) np)
{
return table_.move_insert_node_type(np);
return table_.move_insert_node_type_equiv(np);
}
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
{
return table_.move_insert_node_type_with_hint(hint, np);
return table_.move_insert_node_type_with_hint_equiv(hint, np);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -1515,7 +1515,7 @@ template <class InputIt>
void unordered_map<K, T, H, P, A>::insert(InputIt first, InputIt last)
{
if (first != last) {
table_.insert_range_impl(
table_.insert_range_unique(
table::extractor::extract(*first), first, last);
}
}
@ -1536,7 +1536,7 @@ unordered_map<K, T, H, P, A>::erase(iterator position)
node_pointer node = table::get_node(position);
BOOST_ASSERT(node);
node_pointer next = table::node_algo::next_node(node);
table_.erase_nodes(node, next);
table_.erase_nodes_unique(node, next);
return iterator(next);
}
@ -1547,7 +1547,7 @@ unordered_map<K, T, H, P, A>::erase(const_iterator position)
node_pointer node = table::get_node(position);
BOOST_ASSERT(node);
node_pointer next = table::node_algo::next_node(node);
table_.erase_nodes(node, next);
table_.erase_nodes_unique(node, next);
return iterator(next);
}
@ -1555,7 +1555,7 @@ template <class K, class T, class H, class P, class A>
typename unordered_map<K, T, H, P, A>::size_type
unordered_map<K, T, H, P, A>::erase(const key_type& k)
{
return table_.erase_key(k);
return table_.erase_key_unique(k);
}
template <class K, class T, class H, class P, class A>
@ -1565,7 +1565,7 @@ 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)
return iterator(last_node);
table_.erase_nodes(table::get_node(first), last_node);
table_.erase_nodes_unique(table::get_node(first), last_node);
return iterator(last_node);
}
@ -1593,7 +1593,7 @@ template <typename H2, typename P2>
void unordered_map<K, T, H, P, A>::merge(
boost::unordered_map<K, T, H2, P2, A>& source)
{
table_.merge_impl(source.table_);
table_.merge_unique(source.table_);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -1602,7 +1602,7 @@ template <typename H2, typename P2>
void unordered_map<K, T, H, P, A>::merge(
boost::unordered_map<K, T, H2, P2, A>&& source)
{
table_.merge_impl(source.table_);
table_.merge_unique(source.table_);
}
#endif
@ -1612,7 +1612,7 @@ template <typename H2, typename P2>
void unordered_map<K, T, H, P, A>::merge(
boost::unordered_multimap<K, T, H2, P2, A>& source)
{
table_.merge_impl(source.table_);
table_.merge_unique(source.table_);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -1621,7 +1621,7 @@ template <typename H2, typename P2>
void unordered_map<K, T, H, P, A>::merge(
boost::unordered_multimap<K, T, H2, P2, A>&& source)
{
table_.merge_impl(source.table_);
table_.merge_unique(source.table_);
}
#endif
#endif
@ -1709,14 +1709,14 @@ template <class K, class T, class H, class P, class A>
typename unordered_map<K, T, H, P, A>::mapped_type&
unordered_map<K, T, H, P, A>::operator[](const key_type& k)
{
return table_.try_emplace_impl(k).first->second;
return table_.try_emplace_unique(k).first->second;
}
template <class K, class T, class H, class P, class A>
typename unordered_map<K, T, H, P, A>::mapped_type&
unordered_map<K, T, H, P, A>::operator[](BOOST_RV_REF(key_type) k)
{
return table_.try_emplace_impl(boost::move(k)).first->second;
return table_.try_emplace_unique(boost::move(k)).first->second;
}
template <class K, class T, class H, class P, class A>
@ -1793,7 +1793,7 @@ inline bool operator==(unordered_map<K, T, H, P, A> const& m1,
unordered_map<K, T, H, P, A> x;
};
#endif
return m1.table_.equals(m2.table_);
return m1.table_.equals_unique(m2.table_);
}
template <class K, class T, class H, class P, class A>
@ -1806,7 +1806,7 @@ inline bool operator!=(unordered_map<K, T, H, P, A> const& m1,
unordered_map<K, T, H, P, A> x;
};
#endif
return !m1.table_.equals(m2.table_);
return !m1.table_.equals_unique(m2.table_);
}
template <class K, class T, class H, class P, class A>
@ -1990,7 +1990,7 @@ template <class K, class T, class H, class P, class A>
template <class InputIt>
void unordered_multimap<K, T, H, P, A>::insert(InputIt first, InputIt last)
{
table_.insert_range(first, last);
table_.insert_range_equiv(first, last);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@ -2009,7 +2009,7 @@ unordered_multimap<K, T, H, P, A>::erase(iterator position)
node_pointer node = table::get_node(position);
BOOST_ASSERT(node);
node_pointer next = table::node_algo::next_node(node);
table_.erase_nodes(node, next);
table_.erase_nodes_equiv(node, next);
return iterator(next);
}
@ -2020,7 +2020,7 @@ unordered_multimap<K, T, H, P, A>::erase(const_iterator position)
node_pointer node = table::get_node(position);
BOOST_ASSERT(node);
node_pointer next = table::node_algo::next_node(node);
table_.erase_nodes(node, next);
table_.erase_nodes_equiv(node, next);
return iterator(next);
}
@ -2028,7 +2028,7 @@ template <class K, class T, class H, class P, class A>
typename unordered_multimap<K, T, H, P, A>::size_type
unordered_multimap<K, T, H, P, A>::erase(const key_type& k)
{
return table_.erase_key(k);
return table_.erase_key_equiv(k);
}
template <class K, class T, class H, class P, class A>
@ -2039,7 +2039,7 @@ unordered_multimap<K, T, H, P, A>::erase(
node_pointer last_node = table::get_node(last);
if (first == last)
return iterator(last_node);
table_.erase_nodes(table::get_node(first), last_node);
table_.erase_nodes_equiv(table::get_node(first), last_node);
return iterator(last_node);
}
@ -2234,7 +2234,7 @@ inline bool operator==(unordered_multimap<K, T, H, P, A> const& m1,
unordered_multimap<K, T, H, P, A> x;
};
#endif
return m1.table_.equals(m2.table_);
return m1.table_.equals_equiv(m2.table_);
}
template <class K, class T, class H, class P, class A>
@ -2247,7 +2247,7 @@ inline bool operator!=(unordered_multimap<K, T, H, P, A> const& m1,
unordered_multimap<K, T, H, P, A> x;
};
#endif
return !m1.table_.equals(m2.table_);
return !m1.table_.equals_equiv(m2.table_);
}
template <class K, class T, class H, class P, class A>

View File

@ -220,7 +220,7 @@ template <class T, class H, class P, class A> class unordered_set
template <class... Args>
std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
{
return table_.emplace_impl(
return table_.emplace_unique(
table::extractor::extract(boost::forward<Args>(args)...),
boost::forward<Args>(args)...);
}
@ -246,7 +246,7 @@ template <class T, class H, class P, class A> class unordered_set
template <typename A0>
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
{
return table_.emplace_impl(
return table_.emplace_unique(
table::extractor::extract(boost::forward<A0>(a0)),
boost::unordered::detail::create_emplace_args(
boost::forward<A0>(a0)));
@ -256,7 +256,7 @@ template <class T, class H, class P, class A> class unordered_set
std::pair<iterator, bool> emplace(
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return table_.emplace_impl(
return table_.emplace_unique(
table::extractor::extract(
boost::forward<A0>(a0), boost::forward<A1>(a1)),
boost::unordered::detail::create_emplace_args(
@ -267,7 +267,7 @@ template <class T, class H, class P, class A> class unordered_set
std::pair<iterator, bool> emplace(
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
{
return table_.emplace_impl(
return table_.emplace_unique(
table::extractor::extract(
boost::forward<A0>(a0), boost::forward<A1>(a1)),
boost::unordered::detail::create_emplace_args(
@ -282,7 +282,7 @@ template <class T, class H, class P, class A> class unordered_set
template <class... Args>
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
return table_.emplace_hint_impl(hint,
return table_.emplace_hint_unique(hint,
table::extractor::extract(boost::forward<Args>(args)...),
boost::forward<Args>(args)...);
}
@ -304,17 +304,17 @@ template <class T, class H, class P, class A> class unordered_set
template <typename A0>
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
{
return table_.emplace_hint_impl(hint,
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>
iterator emplace_hint(
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return table_.emplace_hint_impl(
return table_.emplace_hint_unique(
hint, table::extractor::extract(
boost::forward<A0>(a0), boost::forward<A1>(a1)),
boost::unordered::detail::create_emplace_args(
@ -325,7 +325,7 @@ 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, BOOST_FWD_REF(A2) a2)
{
return table_.emplace_hint_impl(
return table_.emplace_hint_unique(
hint, table::extractor::extract(
boost::forward<A0>(a0), boost::forward<A1>(a1)),
boost::unordered::detail::create_emplace_args(
@ -342,7 +342,7 @@ template <class T, class H, class P, class A> class unordered_set
std::pair<iterator, bool> emplace( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return table_.emplace_impl( \
return table_.emplace_unique( \
table::extractor::extract( \
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
boost::unordered::detail::create_emplace_args( \
@ -353,7 +353,7 @@ template <class T, class H, class P, class A> class unordered_set
iterator emplace_hint(const_iterator hint, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return table_.emplace_hint_impl( \
return table_.emplace_hint_unique( \
hint, table::extractor::extract( \
boost::forward<A0>(a0), boost::forward<A1>(a1)), \
boost::unordered::detail::create_emplace_args( \
@ -404,7 +404,7 @@ template <class T, class H, class P, class A> class unordered_set
node_type extract(const_iterator position)
{
return node_type(
table_.extract_by_iterator(position), table_.node_alloc());
table_.extract_by_iterator_unique(position), table_.node_alloc());
}
node_type extract(const key_type& k)
@ -415,13 +415,13 @@ template <class T, class H, class P, class A> class unordered_set
insert_return_type insert(BOOST_RV_REF(node_type) np)
{
insert_return_type result;
table_.move_insert_node_type(np, result);
table_.move_insert_node_type_unique(np, result);
return boost::move(result);
}
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
{
return table_.move_insert_node_type_with_hint(hint, np);
return table_.move_insert_node_type_with_hint_unique(hint, np);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -730,7 +730,7 @@ template <class T, class H, class P, class A> class unordered_multiset
template <class... Args> iterator emplace(BOOST_FWD_REF(Args)... args)
{
return iterator(table_.emplace_impl(
return iterator(table_.emplace_equiv(
boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(), boost::forward<Args>(args)...)));
}
@ -754,7 +754,7 @@ template <class T, class H, class P, class A> class unordered_multiset
template <typename A0> iterator emplace(BOOST_FWD_REF(A0) a0)
{
return iterator(table_.emplace_impl(
return iterator(table_.emplace_equiv(
boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -764,7 +764,7 @@ template <class T, class H, class P, class A> class unordered_multiset
template <typename A0, typename A1>
iterator emplace(BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return iterator(table_.emplace_impl(
return iterator(table_.emplace_equiv(
boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -775,7 +775,7 @@ template <class T, class H, class P, class A> class unordered_multiset
iterator emplace(
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
{
return iterator(table_.emplace_impl(
return iterator(table_.emplace_equiv(
boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -790,7 +790,7 @@ template <class T, class H, class P, class A> class unordered_multiset
template <class... Args>
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
return iterator(table_.emplace_hint_impl(
return iterator(table_.emplace_hint_equiv(
hint, boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(), boost::forward<Args>(args)...)));
}
@ -812,7 +812,7 @@ template <class T, class H, class P, class A> class unordered_multiset
template <typename A0>
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
{
return iterator(table_.emplace_hint_impl(
return iterator(table_.emplace_hint_equiv(
hint, boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -823,7 +823,7 @@ template <class T, class H, class P, class A> class unordered_multiset
iterator emplace_hint(
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
{
return iterator(table_.emplace_hint_impl(
return iterator(table_.emplace_hint_equiv(
hint, boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -834,7 +834,7 @@ template <class T, class H, class P, class A> class unordered_multiset
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0,
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
{
return iterator(table_.emplace_hint_impl(
return iterator(table_.emplace_hint_equiv(
hint, boost::unordered::detail::func::construct_node_from_args(
table_.node_alloc(),
boost::unordered::detail::create_emplace_args(
@ -850,7 +850,7 @@ template <class T, class H, class P, class A> class unordered_multiset
template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
iterator emplace(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return iterator(table_.emplace_impl( \
return iterator(table_.emplace_equiv( \
boost::unordered::detail::func::construct_node_from_args( \
table_.node_alloc(), \
boost::unordered::detail::create_emplace_args( \
@ -861,7 +861,7 @@ template <class T, class H, class P, class A> class unordered_multiset
iterator emplace_hint(const_iterator hint, \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \
{ \
return iterator(table_.emplace_hint_impl( \
return iterator(table_.emplace_hint_equiv( \
hint, \
boost::unordered::detail::func::construct_node_from_args( \
table_.node_alloc(), \
@ -910,7 +910,7 @@ template <class T, class H, class P, class A> class unordered_multiset
node_type extract(const_iterator position)
{
return node_type(
table_.extract_by_iterator(position), table_.node_alloc());
table_.extract_by_iterator_equiv(position), table_.node_alloc());
}
node_type extract(const key_type& k)
@ -920,12 +920,12 @@ template <class T, class H, class P, class A> class unordered_multiset
iterator insert(BOOST_RV_REF(node_type) np)
{
return table_.move_insert_node_type(np);
return table_.move_insert_node_type_equiv(np);
}
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
{
return table_.move_insert_node_type_with_hint(hint, np);
return table_.move_insert_node_type_with_hint_equiv(hint, np);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -1211,7 +1211,7 @@ template <class InputIt>
void unordered_set<T, H, P, A>::insert(InputIt first, InputIt last)
{
if (first != last) {
table_.insert_range_impl(
table_.insert_range_unique(
table::extractor::extract(*first), first, last);
}
}
@ -1231,7 +1231,7 @@ typename unordered_set<T, H, P, A>::iterator unordered_set<T, H, P, A>::erase(
node_pointer node = table::get_node(position);
BOOST_ASSERT(node);
node_pointer next = table::node_algo::next_node(node);
table_.erase_nodes(node, next);
table_.erase_nodes_unique(node, next);
return iterator(next);
}
@ -1239,7 +1239,7 @@ 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)
{
return table_.erase_key(k);
return table_.erase_key_unique(k);
}
template <class T, class H, class P, class A>
@ -1249,7 +1249,7 @@ typename unordered_set<T, H, P, A>::iterator unordered_set<T, H, P, A>::erase(
node_pointer last_node = table::get_node(last);
if (first == last)
return iterator(last_node);
table_.erase_nodes(table::get_node(first), last_node);
table_.erase_nodes_unique(table::get_node(first), last_node);
return iterator(last_node);
}
@ -1293,7 +1293,7 @@ template <typename H2, typename P2>
void unordered_set<T, H, P, A>::merge(
boost::unordered_set<T, H2, P2, A>& source)
{
table_.merge_impl(source.table_);
table_.merge_unique(source.table_);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -1302,7 +1302,7 @@ template <typename H2, typename P2>
void unordered_set<T, H, P, A>::merge(
boost::unordered_set<T, H2, P2, A>&& source)
{
table_.merge_impl(source.table_);
table_.merge_unique(source.table_);
}
#endif
@ -1312,7 +1312,7 @@ template <typename H2, typename P2>
void unordered_set<T, H, P, A>::merge(
boost::unordered_multiset<T, H2, P2, A>& source)
{
table_.merge_impl(source.table_);
table_.merge_unique(source.table_);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -1321,7 +1321,7 @@ template <typename H2, typename P2>
void unordered_set<T, H, P, A>::merge(
boost::unordered_multiset<T, H2, P2, A>&& source)
{
table_.merge_impl(source.table_);
table_.merge_unique(source.table_);
}
#endif
#endif
@ -1408,7 +1408,7 @@ inline bool operator==(
unordered_set<T, H, P, A> x;
};
#endif
return m1.table_.equals(m2.table_);
return m1.table_.equals_unique(m2.table_);
}
template <class T, class H, class P, class A>
@ -1421,7 +1421,7 @@ inline bool operator!=(
unordered_set<T, H, P, A> x;
};
#endif
return !m1.table_.equals(m2.table_);
return !m1.table_.equals_unique(m2.table_);
}
template <class T, class H, class P, class A>
@ -1604,7 +1604,7 @@ template <class T, class H, class P, class A>
template <class InputIt>
void unordered_multiset<T, H, P, A>::insert(InputIt first, InputIt last)
{
table_.insert_range(first, last);
table_.insert_range_equiv(first, last);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@ -1623,7 +1623,7 @@ unordered_multiset<T, H, P, A>::erase(const_iterator position)
node_pointer node = table::get_node(position);
BOOST_ASSERT(node);
node_pointer next = table::node_algo::next_node(node);
table_.erase_nodes(node, next);
table_.erase_nodes_equiv(node, next);
return iterator(next);
}
@ -1631,7 +1631,7 @@ template <class T, class H, class P, class A>
typename unordered_multiset<T, H, P, A>::size_type
unordered_multiset<T, H, P, A>::erase(const key_type& k)
{
return table_.erase_key(k);
return table_.erase_key_equiv(k);
}
template <class T, class H, class P, class A>
@ -1641,7 +1641,7 @@ unordered_multiset<T, H, P, A>::erase(const_iterator first, const_iterator last)
node_pointer last_node = table::get_node(last);
if (first == last)
return iterator(last_node);
table_.erase_nodes(table::get_node(first), last_node);
table_.erase_nodes_equiv(table::get_node(first), last_node);
return iterator(last_node);
}
@ -1809,7 +1809,7 @@ inline bool operator==(unordered_multiset<T, H, P, A> const& m1,
unordered_multiset<T, H, P, A> x;
};
#endif
return m1.table_.equals(m2.table_);
return m1.table_.equals_equiv(m2.table_);
}
template <class T, class H, class P, class A>
@ -1822,7 +1822,7 @@ inline bool operator!=(unordered_multiset<T, H, P, A> const& m1,
unordered_multiset<T, H, P, A> x;
};
#endif
return !m1.table_.equals(m2.table_);
return !m1.table_.equals_equiv(m2.table_);
}
template <class T, class H, class P, class A>