template<class KEY, class VALUE = bslmf::Nil, class TRAITS = HashTableDefaultTraits, class HASH1 = HashTableDefaultHash1, class HASH2 = HashTableDefaultHash2>
class bdlc::HashTable< KEY, VALUE, TRAITS, HASH1, HASH2 >
This class is a double-hashed table. The VALUE template parameter is optional. The capacityHint specified at construction time will be used to compute the number of buckets (capacity) in this object. Also, two hash functions may optionally be specified at construction time. Elements can be inserted using the insert method. If the VALUE parameter is not bslmf::Nil, then both key and value must be supplied to the insert method. Otherwise, only the key should be supplied. The find method can be used to lookup elements by a specified key. The optional TRAITS parameter can be used to classify "null" and "removed" values. See the component-level documentation for more details.
See bdlc_hashtable
template<class KEY , class VALUE , class TRAITS , class HASH1 , class HASH2 >
Create a double-hash table using the specified capacityHint. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless 0 != capacityHint. Note that capacityHint can be either a positive integer or a negative integer. If capacityHint is positive, then the capacity of the hash table will be the first available prime number larger than, or equal to, capacityHint. Otherwise, the capacity of the hash table will be the first available prime number smaller than, or equal to, capacityHint. Also note that HASH1 will be used as the first hash function, and HASH2 will be used as the second hash function.
template<class KEY , class VALUE , class TRAITS , class HASH1 , class HASH2 >
Create a double-hash table with the specified capacityHint. Use the specified hashFunctor1 as the first hash function; use the specified hashFunctor2 as the second hash function. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless 0 != capacityHint, and hashFunction1 and hashFunction2 are valid. Note that capacityHint can be either a positive integer or a negative integer. If capacityHint is positive, then the capacity of the hash table will be the first available prime number larger than, or equal to, capacityHint. Otherwise, the capacity of the hash table will be the first available prime number smaller than, or equal to, capacityHint.
template<class KEY , class VALUE , class TRAITS , class HASH1 , class HASH2 >
Insert an element with the specified key into this object; load a handle to the new element into the specified handle. Return true if successful, and false otherwise. The behavior is undefined unless key does not evaluate to a "null" or "removed" bucket, as defined by the parameterized TRAITS (see the component-level documentation for more details). Note that this method will fail to compile unless the VALUE parameter is bslmf::Nil.
template<class KEY , class VALUE , class TRAITS , class HASH1 , class HASH2 >
| bool bdlc::HashTable< KEY, VALUE, TRAITS, HASH1, HASH2 >::insert |
( |
Handle * |
handle, |
|
|
const KEY & |
key, |
|
|
const VALUE & |
value |
|
) |
| |
|
inline |
Insert an element with the specified key and the specified value into this object; load a handle to the new element into the specified handle. Return true if successful, and false otherwise. The behavior is undefined unless key and value do not evaluate to a "null" or "removed" bucket, as defined by the parameterized TRAITS (see the component-level documentation for more details). This method will fail to compile unless the VALUE parameter is not bslmf::Nil.