Hash policy

Hash policy#

Hash policy of concurrent_unordered_map manages the number of buckets in the container and the allowed maximum number of elements per bucket (load factor). If the maximum load factor is exceeded, the container can automatically increase the number of buckets.

Load factor#

float load_factor() const;

Returns: the average number of elements per bucket, which is size()/unsafe_bucket_count().


float max_load_factor() const;

Returns: the maximum number of elements per bucket.


void max_load_factor( float ml );

Sets the maximum number of elements per bucket to ml.

Manual rehashing#

void rehash( size_type n );

Sets the number of buckets to n and rehashes the container.

void reserve( size_type n );

Sets the number of buckets to the value that is needed to store n elements.