forked from boostorg/unordered
Expand out fill_buckets.
This commit is contained in:
1 parent
992f9ccf21
commit
609ae6cb4e
3 files changed
+89
-97
No files matched your search
@@ -628,17 +628,62 @@ namespace boost { namespace unordered { namespace detail {
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// fill_buckets
|
||||
|
||||
template <class NodeCreator>
|
||||
void fill_buckets(iterator n, NodeCreator& creator)
|
||||
{
|
||||
while (n.node_) {
|
||||
void copy_buckets(table const& src) {
|
||||
node_constructor constructor(this->node_alloc());
|
||||
this->create_buckets(this->bucket_count_);
|
||||
|
||||
for (iterator n = src.begin(); n.node_;) {
|
||||
std::size_t key_hash = n.node_->hash_;
|
||||
iterator group_end(n.node_->group_prev_->next_);
|
||||
|
||||
iterator pos = this->add_node(creator.create(*n), key_hash, iterator());
|
||||
constructor.construct_with_value2(*n);
|
||||
iterator pos = this->add_node(constructor, key_hash, iterator());
|
||||
for (++n; n != group_end; ++n)
|
||||
{
|
||||
this->add_node(creator.create(*n), key_hash, pos);
|
||||
constructor.construct_with_value2(*n);
|
||||
this->add_node(constructor, key_hash, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void move_buckets(table& src) {
|
||||
node_constructor constructor(this->node_alloc());
|
||||
this->create_buckets(this->bucket_count_);
|
||||
|
||||
for (iterator n = src.begin(); n.node_;) {
|
||||
std::size_t key_hash = n.node_->hash_;
|
||||
iterator group_end(n.node_->group_prev_->next_);
|
||||
constructor.construct_with_value2(boost::move(*n));
|
||||
iterator pos = this->add_node(constructor, key_hash, iterator());
|
||||
for (++n; n != group_end; ++n)
|
||||
{
|
||||
constructor.construct_with_value2(boost::move(*n));
|
||||
this->add_node(constructor, key_hash, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void assign_buckets(table const& src) {
|
||||
node_holder<node_allocator> holder(*this);
|
||||
for (iterator n = src.begin(); n.node_;) {
|
||||
std::size_t key_hash = n.node_->hash_;
|
||||
iterator group_end(n.node_->group_prev_->next_);
|
||||
iterator pos = this->add_node(holder.copy_of(*n), key_hash, iterator());
|
||||
for (++n; n != group_end; ++n)
|
||||
{
|
||||
this->add_node(holder.copy_of(*n), key_hash, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void move_assign_buckets(table& src) {
|
||||
node_holder<node_allocator> holder(*this);
|
||||
for (iterator n = src.begin(); n.node_;) {
|
||||
std::size_t key_hash = n.node_->hash_;
|
||||
iterator group_end(n.node_->group_prev_->next_);
|
||||
iterator pos = this->add_node(holder.move_copy_of(*n), key_hash, iterator());
|
||||
for (++n; n != group_end; ++n)
|
||||
{
|
||||
this->add_node(holder.move_copy_of(*n), key_hash, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user