Clean up warnings. Fixes trac #9377.

This commit is contained in:
Daniel James
2014-01-26 22:57:14 +00:00
parent 9ca8c691ac
commit 94071cc6e8
9 changed files with 48 additions and 50 deletions
+19 -19
View File
@@ -537,9 +537,9 @@ namespace boost { namespace unordered { namespace detail {
node_pointer first_node = static_cast<node_pointer>(prev->next_);
link_pointer end = first_node->group_prev_->next_;
std::size_t count = this->delete_nodes(prev, end);
std::size_t deleted_count = this->delete_nodes(prev, end);
this->fix_bucket(bucket_index, prev);
return count;
return deleted_count;
}
iterator erase(c_iterator r)
@@ -558,21 +558,21 @@ namespace boost { namespace unordered { namespace detail {
return iterator(r2.node_);
}
link_pointer erase_nodes(node_pointer begin, node_pointer end)
link_pointer erase_nodes(node_pointer i, node_pointer j)
{
std::size_t bucket_index = this->hash_to_bucket(begin->hash_);
std::size_t bucket_index = this->hash_to_bucket(i->hash_);
// Split the groups containing 'begin' and 'end'.
// And get the pointer to the node before begin while
// Split the groups containing 'i' and 'j'.
// And get the pointer to the node before i while
// we're at it.
link_pointer prev = split_groups(begin, end);
link_pointer prev = split_groups(i, j);
// If we don't have a 'prev' it means that begin is at the
// If we don't have a 'prev' it means that i is at the
// beginning of a block, so search through the blocks in the
// same bucket.
if (!prev) {
prev = this->get_previous_start(bucket_index);
while (prev->next_ != begin)
while (prev->next_ != i)
prev = static_cast<node_pointer>(prev->next_)->group_prev_;
}
@@ -582,24 +582,24 @@ namespace boost { namespace unordered { namespace detail {
static_cast<node_pointer>(prev->next_)->group_prev_->next_;
this->delete_nodes(prev, group_end);
bucket_index = this->fix_bucket(bucket_index, prev);
} while(prev->next_ != end);
} while(prev->next_ != j);
return prev;
}
static link_pointer split_groups(node_pointer begin, node_pointer end)
static link_pointer split_groups(node_pointer i, node_pointer j)
{
node_pointer prev = begin->group_prev_;
if (prev->next_ != begin) prev = node_pointer();
node_pointer prev = i->group_prev_;
if (prev->next_ != i) prev = node_pointer();
if (end) {
node_pointer first = end;
while (first != begin && first->group_prev_->next_ == first) {
if (j) {
node_pointer first = j;
while (first != i && first->group_prev_->next_ == first) {
first = first->group_prev_;
}
boost::swap(first->group_prev_, end->group_prev_);
if (first == begin) return prev;
boost::swap(first->group_prev_, j->group_prev_);
if (first == i) return prev;
}
if (prev) {
@@ -607,7 +607,7 @@ namespace boost { namespace unordered { namespace detail {
while (first->group_prev_->next_ == first) {
first = first->group_prev_;
}
boost::swap(first->group_prev_, begin->group_prev_);
boost::swap(first->group_prev_, i->group_prev_);
}
return prev;
+12 -12
View File
@@ -262,9 +262,9 @@ namespace boost { namespace unordered { namespace detail {
return prev ? iterator(prev->next_) : iterator();
}
std::size_t hash_to_bucket(std::size_t hash) const
std::size_t hash_to_bucket(std::size_t hash_value) const
{
return policy::to_bucket(bucket_count_, hash);
return policy::to_bucket(bucket_count_, hash_value);
}
float load_factor() const
@@ -400,8 +400,8 @@ namespace boost { namespace unordered { namespace detail {
{
if (x.size_) {
create_buckets(bucket_count_);
copy_nodes<node_allocator> copy(node_alloc());
table_impl::fill_buckets(x.begin(), *this, copy);
copy_nodes<node_allocator> node_creator(node_alloc());
table_impl::fill_buckets(x.begin(), *this, node_creator);
}
}
@@ -414,9 +414,9 @@ namespace boost { namespace unordered { namespace detail {
// TODO: Could pick new bucket size?
create_buckets(bucket_count_);
move_nodes<node_allocator> move(node_alloc());
move_nodes<node_allocator> node_creator(node_alloc());
node_holder<node_allocator> nodes(x);
table_impl::fill_buckets(nodes.begin(), *this, move);
table_impl::fill_buckets(nodes.begin(), *this, node_creator);
}
}
@@ -660,8 +660,8 @@ namespace boost { namespace unordered { namespace detail {
// assign_nodes takes ownership of the container's elements,
// assigning to them if possible, and deleting any that are
// left over.
assign_nodes<table> assign(*this);
table_impl::fill_buckets(x.begin(), *this, assign);
assign_nodes<table> node_creator(*this);
table_impl::fill_buckets(x.begin(), *this, node_creator);
}
void assign(table const& x, true_type)
@@ -687,8 +687,8 @@ namespace boost { namespace unordered { namespace detail {
// Finally copy the elements.
if (x.size_) {
create_buckets(bucket_count_);
copy_nodes<node_allocator> copy(node_alloc());
table_impl::fill_buckets(x.begin(), *this, copy);
copy_nodes<node_allocator> node_creator(node_alloc());
table_impl::fill_buckets(x.begin(), *this, node_creator);
}
}
}
@@ -735,9 +735,9 @@ namespace boost { namespace unordered { namespace detail {
// move_assign_nodes takes ownership of the container's
// elements, assigning to them if possible, and deleting
// any that are left over.
move_assign_nodes<table> assign(*this);
move_assign_nodes<table> node_creator(*this);
node_holder<node_allocator> nodes(x);
table_impl::fill_buckets(nodes.begin(), *this, assign);
table_impl::fill_buckets(nodes.begin(), *this, node_creator);
}
}
+7 -7
View File
@@ -530,9 +530,9 @@ namespace boost { namespace unordered { namespace detail {
link_pointer end = static_cast<node_pointer>(prev->next_)->next_;
std::size_t count = this->delete_nodes(prev, end);
std::size_t deleted_count = this->delete_nodes(prev, end);
this->fix_bucket(bucket_index, prev);
return count;
return deleted_count;
}
iterator erase(c_iterator r)
@@ -551,19 +551,19 @@ namespace boost { namespace unordered { namespace detail {
return iterator(r2.node_);
}
void erase_nodes(node_pointer begin, node_pointer end)
void erase_nodes(node_pointer i, node_pointer j)
{
std::size_t bucket_index = this->hash_to_bucket(begin->hash_);
std::size_t bucket_index = this->hash_to_bucket(i->hash_);
// Find the node before begin.
// Find the node before i.
link_pointer prev = this->get_previous_start(bucket_index);
while(prev->next_ != begin) prev = prev->next_;
while(prev->next_ != i) prev = prev->next_;
// Delete the nodes.
do {
this->delete_node(prev);
bucket_index = this->fix_bucket(bucket_index, prev);
} while (prev->next_ != end);
} while (prev->next_ != j);
}
////////////////////////////////////////////////////////////////////////