diff --git a/include/boost/unordered/detail/table.hpp b/include/boost/unordered/detail/table.hpp index 4d47ee67..8d94bcd7 100644 --- a/include/boost/unordered/detail/table.hpp +++ b/include/boost/unordered/detail/table.hpp @@ -443,23 +443,19 @@ namespace boost { namespace unordered_detail { this->create_buckets(); this->init_buckets(); } - // TODO: Another bug: - else if(min_buckets != this->bucket_count_) { + else { // no throw: // TODO: Needlessly calling next_prime twice. std::size_t min_size = this->min_buckets_for_size(this->size_); min_buckets = next_prime(min_buckets); min_buckets = min_size > min_buckets ? min_size : min_buckets; - - rehash_impl(min_buckets); + if(min_buckets != this->bucket_count_) rehash_impl(min_buckets); } } // if hash function throws, basic exception safety // strong otherwise - // TODO: Rewrite so that it doesn't need to keep updating size_. - template void hash_table ::rehash_impl(std::size_t num_buckets)