forked from boostorg/unordered
Fix a bug that was causing unnecessary rehahes.
[SVN r56348]
This commit is contained in:
@ -443,23 +443,19 @@ namespace boost { namespace unordered_detail {
|
|||||||
this->create_buckets();
|
this->create_buckets();
|
||||||
this->init_buckets();
|
this->init_buckets();
|
||||||
}
|
}
|
||||||
// TODO: Another bug:
|
else {
|
||||||
else if(min_buckets != this->bucket_count_) {
|
|
||||||
// no throw:
|
// no throw:
|
||||||
// TODO: Needlessly calling next_prime twice.
|
// TODO: Needlessly calling next_prime twice.
|
||||||
std::size_t min_size = this->min_buckets_for_size(this->size_);
|
std::size_t min_size = this->min_buckets_for_size(this->size_);
|
||||||
min_buckets = next_prime(min_buckets);
|
min_buckets = next_prime(min_buckets);
|
||||||
min_buckets = min_size > min_buckets ? min_size : min_buckets;
|
min_buckets = min_size > min_buckets ? min_size : min_buckets;
|
||||||
|
if(min_buckets != this->bucket_count_) rehash_impl(min_buckets);
|
||||||
rehash_impl(min_buckets);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if hash function throws, basic exception safety
|
// if hash function throws, basic exception safety
|
||||||
// strong otherwise
|
// strong otherwise
|
||||||
|
|
||||||
// TODO: Rewrite so that it doesn't need to keep updating size_.
|
|
||||||
|
|
||||||
template <class H, class P, class A, class G, class K>
|
template <class H, class P, class A, class G, class K>
|
||||||
void hash_table<H, P, A, G, K>
|
void hash_table<H, P, A, G, K>
|
||||||
::rehash_impl(std::size_t num_buckets)
|
::rehash_impl(std::size_t num_buckets)
|
||||||
|
Reference in New Issue
Block a user