[#BloombergLP-bdlc-HashTable] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::HashTable :relfileprefix: ../../ :mrdocs: 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. == Synopsis Declared in `<bdlc_hashtable.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY, class VALUE = xref:BloombergLP/bslmf/Nil.adoc[bslmf::Nil], class TRAITS = xref:BloombergLP/bdlc/HashTableDefaultTraits.adoc[HashTableDefaultTraits], class HASH1 = xref:BloombergLP/bdlc/HashTableDefaultHash1.adoc[HashTableDefaultHash1], class HASH2 = xref:BloombergLP/bdlc/HashTableDefaultHash2.adoc[HashTableDefaultHash2]> class HashTable; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/HashTable/Handle.adoc[`Handle`] | Data type to handle elements in the double‐hashed table. This value is guaranteed to be between 0 and the capacity of the hash table. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/HashTable/2constructor-05.adoc[`HashTable`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlc/HashTable/2destructor.adoc[`~HashTable`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/bdlc/HashTable/capacity.adoc[`capacity`] | Return the maximum number of elements that can be stored in this object. Note that this value is computed based on the capacity hint used upon construction. | xref:BloombergLP/bdlc/HashTable/capacityHint.adoc[`capacityHint`] | Return the capacity hint that was used to determine the capacity of this object. | xref:BloombergLP/bdlc/HashTable/find.adoc[`find`] | Find an element having the specified `key`; load a handle to the element into the specified `handle`. Return true if successful, and false otherwise. | xref:BloombergLP/bdlc/HashTable/insert-05.adoc[`insert`] | `insert` overloads | xref:BloombergLP/bdlc/HashTable/key.adoc[`key`] | Return the reference to the non‐modifiable key of the element identified by the specified `handle`. The behavior is undefined unless `handle` is valid. | xref:BloombergLP/bdlc/HashTable/maxChain.adoc[`maxChain`] | Return the maximum chain length encountered by this object. | xref:BloombergLP/bdlc/HashTable/numCollisions.adoc[`numCollisions`] | Return the number of collisions encountered by this object. | xref:BloombergLP/bdlc/HashTable/remove.adoc[`remove`] | Remove the element identified by the specified `handle` from this object. The behavior is undefined unless `handle` is valid. Note that `handle` will become invalid when this method returns. | xref:BloombergLP/bdlc/HashTable/size.adoc[`size`] | Return the number of elements stored in this object. | xref:BloombergLP/bdlc/HashTable/totalChain.adoc[`totalChain`] | Return the total chain length encountered by this object. | xref:BloombergLP/bdlc/HashTable/value-0d.adoc[`value`] | `value` overloads | xref:BloombergLP/bdlc/HashTable/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<HashTable, UsesBslmaAllocator>`] | Declare that this type uses a `bslma` allocator. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#