Simple Application Framework
1
|
Hash table policy where the bucket count is always a prime number. More...
#include <HashTablePolicy.h>
Public Member Functions | |
Size | BucketIndex (Size hash, Size buckets) const |
Convert hash value to a bucket index. | |
Size | NextBucketCount (Size bucketHint) const |
Return bucket count greater or equal to bucketHint complying to the policy rules. | |
Size | OptimalBucketCount (Size bucketHint, Size elements) const |
Return optimal bucket count for given number of elements greater or equal to bucketHint . | |
Collection::Pair< bool, Size > | ShouldResize (Size elements, Size buckets) const |
Check whether the table should resize. | |
Static Protected Attributes | |
static Size | ms_primeList [] |
Selected prime numbers. | |
static Size | ms_primes |
Number of avilable primes. |
Hash table policy where the bucket count is always a prime number.
Possibly slower than PowerOf2Policy but more likely to avoid collisions.
Size Saf::Algo::Struct::HashPolicy::PrimePolicy::BucketIndex | ( | Size | hash, |
Size | buckets | ||
) | const [inline] |
Convert hash value to a bucket index.
Size Saf::Algo::Struct::HashPolicy::PrimePolicy::NextBucketCount | ( | Size | bucketHint | ) | const [inline] |
Return bucket count greater or equal to bucketHint
complying to the policy rules.
Size Saf::Algo::Struct::HashPolicy::PrimePolicy::OptimalBucketCount | ( | Size | bucketHint, |
Size | elements | ||
) | const [inline] |
Return optimal bucket count for given number of elements greater or equal to bucketHint
.
Collection::Pair<bool,Size> Saf::Algo::Struct::HashPolicy::PrimePolicy::ShouldResize | ( | Size | elements, |
Size | buckets | ||
) | const [inline] |
Check whether the table should resize.
Currently the table is allowed to grow only, i.e., there is no minimum load factor.
Size Saf::Algo::Struct::HashPolicy::PrimePolicy::ms_primeList[] [static, protected] |
Selected prime numbers.
Size Saf::Algo::Struct::HashPolicy::PrimePolicy::ms_primes [static, protected] |
Number of avilable primes.