HashTable |
HashTableSummary
HashFunctionDefines the interface to a hash function. Takes a const char * as an argument and returns a size_t. typedef size_t HashFunction (const char *); Here is a simple, but very inefficient, hash function (from SMAUG); size_t SmaugHash(const char * str) This is however a lousy hash function, since it distributes strings extremely poorly. See the sample hash table manager for a better hash function. ConstructorConstruct a new hash table implementation of the shared string manager. Note that you need to pass in a hash function: see the HashFunction typedef. Parameters
rehash
Resize the array of buckets, and rehash all table contents into the new buckets. Use this if you have too many elements per bucket and don’t mind spending more memory on buckets. Note that this will only be useful if your hash function is good enough to distribute over all the buckets. Parameters
|
Resize the array of buckets, and rehash all table contents into the new buckets.
void rehash( size_t newSize )