[#BloombergLP-bslstl-HashTable-2constructor-09]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/HashTable.adoc[HashTable]::HashTable
:relfileprefix: ../../../
:mrdocs:

Create an empty hash table with the specified policies and capacity&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
HashTable(
    HASHER const& hash,
    COMPARATOR const& compare,
    xref:BloombergLP/bslstl/HashTable/SizeType.adoc[SizeType] initialNumBuckets,
    float initialMaxLoadFactor,
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

== Description

Create an empty hash&hyphen;table using the specified `hash` and `compare` functors to organize elements in the table, which will initially have at least the specified `initialNumBuckets` and a `maxLoadFactor` of the specified `initialMaxLoadFactor`&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not supplied, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used to supply memory&period; If this constructor tries to allocate a number of buckets larger than can be represented by this hash&hyphen;table&apos;s `SizeType`, a `std&colon;&colon;length&lowbar;error` exception is thrown&period; The behavior is undefined unless `0 &lt; initialMaxLoadFactor`&period; Note that more than `initialNumBuckets` buckets may be created in order to preserve the bucket allocation strategy of the hash&hyphen;table (but never fewer)&period; Also note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *hash*
| hash functor used to organize elements
| *compare*
| key&hyphen;equality comparator
| *initialNumBuckets*
| minimum initial number of buckets
| *initialMaxLoadFactor*
| initial maximum load factor
| *basicAllocator*
| allocator used to supply memory
|===


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