Unordered: Fix bug when erasing a range, refs #7471.

[SVN r80894]
This commit is contained in:
Daniel James
2012-10-07 08:19:01 +00:00
parent 9b398ba0c9
commit 8f8ea09ce8
5 changed files with 56 additions and 3 deletions

View File

@@ -676,9 +676,9 @@ namespace boost { namespace unordered { namespace detail {
if(begin == group2) {
link_pointer end1 = group1->group_prev_;
link_pointer end2 = group2->group_prev_;
link_pointer end2 = end->group_prev_;
group1->group_prev_ = end2;
group2->group_prev_ = end1;
end->group_prev_ = end1;
}
}
}

View File

@@ -618,7 +618,16 @@ namespace boost { namespace unordered { namespace detail {
{
for(;;) {
n = static_cast<node_pointer>(n->next_);
if (n == end) return;
if (n == end) {
if (n) {
std::size_t new_bucket_index =
policy::to_bucket(bucket_count_, n->hash_);
if (bucket_index != new_bucket_index) {
get_bucket(new_bucket_index)->next_ = prev;
}
}
return;
}
std::size_t new_bucket_index =
policy::to_bucket(bucket_count_, n->hash_);