#include <bslstl_hashtable.h>
This utility struct provides a namespace for functions that are useful when implementing a hash table.
See bslstl_hashtable
◆ defaultBucketAddress()
Return the address of a statically initialized empty bucket that can be shared as the (un-owned) bucket array by all empty hash tables.
◆ growBucketsForLoadFactor()
| static size_t bslstl::HashTable_ImpDetails::growBucketsForLoadFactor |
( |
size_t * |
capacity, |
|
|
size_t |
minElements, |
|
|
size_t |
requestedBuckets, |
|
|
double |
maxLoadFactor |
|
) |
| |
|
static |
Return the suggested number of buckets to index a linked list that can hold as many as the specified minElements without exceeding the specified maxLoadFactor, and supporting at least the specified number of requestedBuckets. Set the specified *capacity to the maximum length of linked list that the returned number of buckets could index without exceeding the maxLoadFactor.
- Precondition
- The behavior is undefined unless
0 < maxLoadFactor, 0 < minElements and 0 < requestedBuckets.
◆ incidentalAllocator()
Return that address of an allocator that can be used to allocate temporary storage, but that is neither the default nor global allocator.
- Note
- Note that this function is intended to support detailed checks in
SAFE_2 builds, that may need additional storage for the evaluation of a validity check on a large data structure, but that should not change the expected values computed for regular allocator usage of the component as validated by the test driver.
◆ nextPrime()
| static size_t bslstl::HashTable_ImpDetails::nextPrime |
( |
size_t |
n | ) |
|
|
static |
Return the next prime number greater-than or equal to the specified n in the increasing sequence of primes chosen to disperse hash codes across buckets as uniformly as possible. Throw a std::length_error exception if n is greater than the last prime number in the sequence.
- Note
- Note that, typically, prime numbers in the sequence have increasing values that reflect a growth factor (e.g., each value in the sequence may be, approximately, two times the preceding value).
The documentation for this struct was generated from the following file: