mirror of
https://github.com/boostorg/unordered.git
synced 2025-10-19 10:55:29 +02:00
Unordered: Support empty containers in node_holder.
[SVN r80562]
This commit is contained in:
@@ -444,10 +444,12 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
base(b.node_alloc()),
|
base(b.node_alloc()),
|
||||||
nodes_()
|
nodes_()
|
||||||
{
|
{
|
||||||
typename Table::previous_pointer prev = b.get_previous_start();
|
if (b.size_) {
|
||||||
nodes_ = static_cast<node_pointer>(prev->next_);
|
typename Table::previous_pointer prev = b.get_previous_start();
|
||||||
prev->next_ = link_pointer();
|
nodes_ = static_cast<node_pointer>(prev->next_);
|
||||||
b.size_ = 0;
|
prev->next_ = link_pointer();
|
||||||
|
b.size_ = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~node_holder();
|
~node_holder();
|
||||||
@@ -508,7 +510,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator get_start() const
|
iterator begin() const
|
||||||
{
|
{
|
||||||
return iterator(nodes_);
|
return iterator(nodes_);
|
||||||
}
|
}
|
||||||
|
@@ -400,7 +400,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
move_nodes<node_allocator> move(node_alloc());
|
move_nodes<node_allocator> move(node_alloc());
|
||||||
node_holder<node_allocator> nodes(x);
|
node_holder<node_allocator> nodes(x);
|
||||||
table_impl::fill_buckets(nodes.get_start(), *this, move);
|
table_impl::fill_buckets(nodes.begin(), *this, move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,11 +765,8 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
// elements, assigning to them if possible, and deleting
|
// elements, assigning to them if possible, and deleting
|
||||||
// any that are left over.
|
// any that are left over.
|
||||||
move_assign_nodes<table> assign(*this);
|
move_assign_nodes<table> assign(*this);
|
||||||
|
node_holder<node_allocator> nodes(x);
|
||||||
if (x.size_) {
|
table_impl::fill_buckets(nodes.begin(), *this, assign);
|
||||||
node_holder<node_allocator> nodes(x);
|
|
||||||
table_impl::fill_buckets(nodes.get_start(), *this, assign);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user