mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
Update internal table to allocate on construction and when rehashing
This commit is contained in:
@ -2486,6 +2486,7 @@ namespace boost {
|
|||||||
bucket_count_(policy::new_bucket_count(num_buckets)), size_(0),
|
bucket_count_(policy::new_bucket_count(num_buckets)), size_(0),
|
||||||
mlf_(1.0f), max_load_(0), buckets_()
|
mlf_(1.0f), max_load_(0), buckets_()
|
||||||
{
|
{
|
||||||
|
this->create_buckets(bucket_count_);
|
||||||
}
|
}
|
||||||
|
|
||||||
table(table const& x, node_allocator const& a)
|
table(table const& x, node_allocator const& a)
|
||||||
@ -3951,8 +3952,10 @@ namespace boost {
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
if (!size_) {
|
if (!size_) {
|
||||||
delete_buckets();
|
min_buckets = policy::new_bucket_count(min_buckets);
|
||||||
bucket_count_ = policy::new_bucket_count(min_buckets);
|
if (min_buckets != bucket_count_) {
|
||||||
|
this->create_buckets(min_buckets);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
min_buckets = policy::new_bucket_count((std::max)(min_buckets,
|
min_buckets = policy::new_bucket_count((std::max)(min_buckets,
|
||||||
boost::unordered::detail::double_to_size(
|
boost::unordered::detail::double_to_size(
|
||||||
|
Reference in New Issue
Block a user