bucket count: 193
about to rehash
allocate: 194
allocate: 4
bucket count: 193
where it can be seen that, even though bucket_count remains the same after rehashing, reallocation has indeed happened. The problem lies in table::rehash:
Unnecessary reallocation happens because, in the example, num_buckets != this->bucket_count() but buckets_.bucket_count_for(num_buckets) == this->bucket_count(). A simple fix is to rewrite as:
Consider this program:
The output against develop is
where it can be seen that, even though
bucket_count
remains the same after rehashing, reallocation has indeed happened. The problem lies intable::rehash
:Unnecessary reallocation happens because, in the example,
num_buckets != this->bucket_count()
butbuckets_.bucket_count_for(num_buckets) == this->bucket_count()
. A simple fix is to rewrite as: