diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index b65d4bc0..8661e408 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -2486,6 +2486,7 @@ namespace boost { bucket_count_(policy::new_bucket_count(num_buckets)), size_(0), mlf_(1.0f), max_load_(0), buckets_() { + this->create_buckets(bucket_count_); } table(table const& x, node_allocator const& a) @@ -3951,8 +3952,10 @@ namespace boost { using namespace std; if (!size_) { - delete_buckets(); - bucket_count_ = policy::new_bucket_count(min_buckets); + min_buckets = policy::new_bucket_count(min_buckets); + if (min_buckets != bucket_count_) { + this->create_buckets(min_buckets); + } } else { min_buckets = policy::new_bucket_count((std::max)(min_buckets, boost::unordered::detail::double_to_size(