[#BloombergLP-bdlc-HashTable]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::HashTable
:relfileprefix: ../../
:mrdocs:

This class is a double&hyphen;hashed table&period; The `VALUE` template parameter is optional&period; The `capacityHint` specified at construction time will be used to compute the number of buckets (capacity) in this object&period; Also, two hash functions may optionally be specified at construction time&period; Elements can be inserted using the `insert` method&period; If the `VALUE` parameter is not `bslmf&colon;&colon;Nil`, then both key and value must be supplied to the `insert` method&period; Otherwise, only the key should be supplied&period; The `find` method can be used to lookup elements by a specified key&period; The optional `TRAITS` parameter can be used to classify &quot;null&quot; and &quot;removed&quot; values&period; See the component&hyphen;level documentation for more details&period;

== Synopsis

Declared in `&lt;bdlc&lowbar;hashtable&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    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]&gt;
class HashTable;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlc/HashTable/Handle.adoc[`Handle`] 
| Data type to handle elements in the double&hyphen;hashed table&period; This value is guaranteed to be between 0 and the capacity of the hash table&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlc/HashTable/2constructor-05.adoc[`HashTable`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlc/HashTable/2destructor.adoc[`&#126;HashTable`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/bdlc/HashTable/capacity.adoc[`capacity`] 
| Return the maximum number of elements that can be stored in this object&period; Note that this value is computed based on the capacity hint used upon construction&period;
| xref:BloombergLP/bdlc/HashTable/capacityHint.adoc[`capacityHint`] 
| Return the capacity hint that was used to determine the capacity of this object&period;
| xref:BloombergLP/bdlc/HashTable/find.adoc[`find`] 
| Find an element having the specified `key`&semi; load a handle to the element into the specified `handle`&period; Return true if successful, and false otherwise&period;
| xref:BloombergLP/bdlc/HashTable/insert-05.adoc[`insert`] 
| `insert` overloads
| xref:BloombergLP/bdlc/HashTable/key.adoc[`key`] 
| Return the reference to the non&hyphen;modifiable key of the element identified by the specified `handle`&period; The behavior is undefined unless `handle` is valid&period;
| xref:BloombergLP/bdlc/HashTable/maxChain.adoc[`maxChain`] 
| Return the maximum chain length encountered by this object&period;
| xref:BloombergLP/bdlc/HashTable/numCollisions.adoc[`numCollisions`] 
| Return the number of collisions encountered by this object&period;
| xref:BloombergLP/bdlc/HashTable/remove.adoc[`remove`] 
| Remove the element identified by the specified `handle` from this object&period; The behavior is undefined unless `handle` is valid&period; Note that `handle` will become invalid when this method returns&period;
| xref:BloombergLP/bdlc/HashTable/size.adoc[`size`] 
| Return the number of elements stored in this object&period;
| xref:BloombergLP/bdlc/HashTable/totalChain.adoc[`totalChain`] 
| Return the total chain length encountered by this object&period;
| xref:BloombergLP/bdlc/HashTable/value-0d.adoc[`value`] 
| `value` overloads
| xref:BloombergLP/bdlc/HashTable/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;HashTable, UsesBslmaAllocator&gt;`] 
| Declare that this type uses a `bslma` allocator&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
