HashTable.rehash

Sets the number of buckets in the container to at least n and rearranges all the elements according to their hash values.

If n is greater than the current $(D_PSYMBOL bucketCount) and lower than or equal to $(D_PSYMBOL maxBucketCount), a rehash is forced.

If n is greater than $(D_PSYMBOL maxBucketCount), $(D_PSYMBOL maxBucketCount) is used instead as a new number of buckets.

If n is less than or equal to the current $(D_PSYMBOL bucketCount), the function may have no effect.

Rehashing is automatically performed whenever the container needs space to insert new elements.

struct HashTable(Key, Value, alias hasher = hash)
void
rehash
(
size_t n
)
if (
isHashFunction!(hasher, Key)
)

Parameters

n size_t

Minimum number of buckets.

Meta