mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 19:37:14 +02:00
Unordered: Use node_holder for move.
[SVN r80383]
This commit is contained in:
@ -443,6 +443,8 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
typedef typename node_allocator_traits::pointer node_pointer;
|
typedef typename node_allocator_traits::pointer node_pointer;
|
||||||
typedef typename node::value_type value_type;
|
typedef typename node::value_type value_type;
|
||||||
typedef typename node::link_pointer link_pointer;
|
typedef typename node::link_pointer link_pointer;
|
||||||
|
typedef boost::unordered::iterator_detail::
|
||||||
|
iterator<node_pointer, value_type> iterator;
|
||||||
|
|
||||||
node_pointer nodes_;
|
node_pointer nodes_;
|
||||||
|
|
||||||
@ -514,6 +516,11 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
return base::release();
|
return base::release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iterator get_start() const
|
||||||
|
{
|
||||||
|
return iterator(nodes_);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Alloc>
|
template <typename Alloc>
|
||||||
|
@ -255,7 +255,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
// TODO: Why not calculate_max_load?
|
// TODO: Why not calculate_max_load?
|
||||||
// TODO: Why do I use x's bucket count?
|
// TODO: Why do I use x's bucket count?
|
||||||
table(table& x, node_allocator const& a,
|
table(table& x, node_allocator const& a,
|
||||||
boost::unordered::detail::move_tag m) :
|
boost::unordered::detail::move_tag) :
|
||||||
buckets(a, x.bucket_count_),
|
buckets(a, x.bucket_count_),
|
||||||
functions(x),
|
functions(x),
|
||||||
mlf_(x.mlf_),
|
mlf_(x.mlf_),
|
||||||
@ -265,14 +265,11 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
this->move_buckets_from(x);
|
this->move_buckets_from(x);
|
||||||
}
|
}
|
||||||
else if(x.size_) {
|
else if(x.size_) {
|
||||||
// Use a temporary table because moving the nodes leaves the
|
|
||||||
// source container in a complete mess.
|
|
||||||
|
|
||||||
buckets tmp(x, m);
|
|
||||||
|
|
||||||
this->create_buckets(this->bucket_count_);
|
this->create_buckets(this->bucket_count_);
|
||||||
|
|
||||||
move_nodes<node_allocator> move(this->node_alloc());
|
move_nodes<node_allocator> move(this->node_alloc());
|
||||||
table_impl::fill_buckets(tmp.get_start(), *this, move);
|
node_holder<node_allocator> nodes(x);
|
||||||
|
table_impl::fill_buckets(nodes.get_start(), *this, move);
|
||||||
|
|
||||||
this->max_load_ = calculate_max_load();
|
this->max_load_ = calculate_max_load();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user