Quick Links:

bal | bbl | bdl | bsl

Static Public Member Functions

bslstl::HashTable_ImpDetails Struct Reference

#include <bslstl_hashtable.h>

List of all members.

Static Public Member Functions

static bslalg::HashTableBucketdefaultBucketAddress ()
static size_t growBucketsForLoadFactor (size_t *capacity, size_t minElements, size_t requestedBuckets, double maxLoadFactor)
static bslma::AllocatorincidentalAllocator ()
static size_t nextPrime (size_t n)

Detailed Description

This utility struct provides a namespace for functions that are useful when implementing a hash table.

See Component bslstl_hashtable


Member Function Documentation

static bslalg::HashTableBucket* bslstl::HashTable_ImpDetails::defaultBucketAddress (  )  [static]

Return the address of a statically initialized empty bucket that can be shared as the (un-owned) bucket array by all empty hash tables.

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. The behavior is undefined unless 0 < maxLoadFactor, 0 < minElements and 0 < requestedBuckets.

static bslma::Allocator* bslstl::HashTable_ImpDetails::incidentalAllocator (  )  [static]

Return that address of an allocator that can be used to allocate temporary storage, but that is neither the default nor global allocator. 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.

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 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: