[#BloombergLP-bslstl-HashTable-09-2constructor-0c]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/HashTable-09.adoc[HashTable&lt;UnorderedMapKeyConfiguration&lt;basic&lowbar;string&lt;char&gt; const, pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;, TransparentHash, TransparentEqualTo, allocator&lt;pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;&gt;]::HashTable
:relfileprefix: ../../../
:mrdocs:

Constructors

== Synopses

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

Create a hash&hyphen;table having the same value (and `maxLoadFactor`) as the specified `original` object by moving (in constant time) the contents of `original` to the new hash&hyphen;table&period; Use a copy of `original&period;hasher()` and a copy of `original&period;comparator()` to organize elements in this hash&hyphen;table&period; The allocator associated with `original` is propagated for use in the newly created hash&hyphen;table&period; `original` is left in a valid but unspecified state&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/HashTable-09/2constructor-00.adoc[HashTable](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;HashTable&lt;UnorderedMapKeyConfiguration&lt;basic&lowbar;string&lt;char&gt; const, pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;, TransparentHash, TransparentEqualTo, allocator&lt;pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;&gt;&gt;] original);
----

[.small]#xref:BloombergLP/bslstl/HashTable-09/2constructor-00.adoc[_» more&period;&period;&period;_]#

Create a hash&hyphen;table having the same value (and `maxLoadFactor`) as the specified `original` object&period; Use a copy of `original&period;hasher()` and a copy of `original&period;comparator()` to organize elements in this hash&hyphen;table&period; Use the allocator returned by &apos;bsl&colon;&colon;allocator&lowbar;traits&lt;ALLOCATOR&gt;&colon;&colon; select&lowbar;on&lowbar;container&lowbar;copy&lowbar;construction(original&period;allocator())&apos; to allocate memory&period; This method requires that the `ValueType` defined by the (template parameter) type `KEY&lowbar;CONFIG` be `copy&hyphen;insertable` into this hash&hyphen;table (see &apos;&lcub;Requirements on `KEY&lowbar;CONFIG`&rcub;)&period; Note that this hash&hyphen;table may have fewer buckets than `original`, and a correspondingly higher `loadFactor`, so long as `maxLoadFactor` is not exceeded&period; Also note that the created hash table may have a different `numBuckets` than `original`, and a correspondingly different `loadFactor`, as long as `maxLoadFactor` is not exceeded&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/HashTable-09/2constructor-0d.adoc[HashTable](xref:BloombergLP/bslstl/HashTable-06.adoc[HashTable&lt;UnorderedMapKeyConfiguration&lt;basic&lowbar;string&lt;char&gt; const, pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;, TransparentHash, TransparentEqualTo, allocator&lt;pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;&gt;] const& original);
----

[.small]#xref:BloombergLP/bslstl/HashTable-09/2constructor-0d.adoc[_» more&period;&period;&period;_]#

Create an empty hash&hyphen;table&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; Use 1&period;0 for the `maxLoadFactor`&period; Use a default constructed object of the (template parameter) type `HASHER` and a default constructed object of the (template parameter) type `COMPARATOR` to organize elements in the table&period; No memory is allocated unless the `HASHER` or `COMPARATOR` types allocate memory in their default constructor&period; 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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:BloombergLP/bslstl/HashTable-09/2constructor-0f.adoc[HashTable](xref:bsl/allocator-0df.adoc[allocator&lt;pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;] const& basicAllocator = ALLOCATOR());
----

[.small]#xref:BloombergLP/bslstl/HashTable-09/2constructor-0f.adoc[_» more&period;&period;&period;_]#

Create a hash table having the same value (and `maxLoadFactor`) as the specified `original` object that uses the specified `basicAllocator` to supply memory&period; The contents of `original` are moved (in constant time) to the new hash&hyphen;table if `basicAllocator &equals;&equals; original&period;get&lowbar;allocator()`, and are move&hyphen;inserted (in linear time) using `basicAllocator` otherwise&period; `original` is left in a valid but unspecified state&period; Use a copy of `original&period;hasher()` and a copy of `original&period;comparator()` to organize elements in this hash&hyphen;table&period; This method requires that the `ValueType` defined by the (template parameter) type `KEY&lowbar;CONFIG` be `move&hyphen;insertable` into this hash&hyphen;table&period; Note that this hash&hyphen;table may have a different `numBuckets` than `original`, and a correspondingly different `loadFactor`, as long as `maxLoadFactor` is not exceeded&period; Also note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the (template parameter) `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/HashTable-09/2constructor-08.adoc[HashTable](
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;HashTable&lt;UnorderedMapKeyConfiguration&lt;basic&lowbar;string&lt;char&gt; const, pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;, TransparentHash, TransparentEqualTo, allocator&lt;pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;&gt;&gt;] original,
    xref:bsl/allocator-0df.adoc[allocator&lt;pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;] const& basicAllocator);
----

[.small]#xref:BloombergLP/bslstl/HashTable-09/2constructor-08.adoc[_» more&period;&period;&period;_]#

Create a hash&hyphen;table having the same value (and `maxLoadFactor`) as the specified `original` object that uses the specified `basicAllocator` to supply memory&period; Use a copy of `original&period;hasher()` and a copy of `original&period;comparator()` to organize elements in this hash&hyphen;table&period; This method requires that the `ValueType` defined by the (template parameter) type `KEY&lowbar;CONFIG` be `move&hyphen;insertable` into this hash&hyphen;table&period; Note that this hash&hyphen;table may have a different `numBuckets` than `original`, and a correspondingly different `loadFactor`, as long as `maxLoadFactor` is not exceeded&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/HashTable-09/2constructor-03.adoc[HashTable](
    xref:BloombergLP/bslstl/HashTable-06.adoc[HashTable&lt;UnorderedMapKeyConfiguration&lt;basic&lowbar;string&lt;char&gt; const, pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;, TransparentHash, TransparentEqualTo, allocator&lt;pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;&gt;] const& original,
    xref:bsl/allocator-0df.adoc[allocator&lt;pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;] const& basicAllocator);
----

[.small]#xref:BloombergLP/bslstl/HashTable-09/2constructor-03.adoc[_» more&period;&period;&period;_]#

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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/HashTable-09/2constructor-0a.adoc[HashTable](
    xref:BloombergLP/bdlb/TransparentHash.adoc[TransparentHash] const& hash,
    xref:BloombergLP/bdlb/TransparentEqualTo.adoc[TransparentEqualTo] const& compare,
    xref:BloombergLP/bslstl/HashTable-09/SizeType.adoc[SizeType] initialNumBuckets,
    float initialMaxLoadFactor,
    xref:bsl/allocator-0df.adoc[allocator&lt;pair&lt;basic&lowbar;string&lt;char&gt; const, Json&gt;&gt;] const& basicAllocator = ALLOCATOR());
----

[.small]#xref:BloombergLP/bslstl/HashTable-09/2constructor-0a.adoc[_» more&period;&period;&period;_]#


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