[#BloombergLP-bdlc-FlatHashMap-2constructor-056]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::xref:BloombergLP/bdlc/FlatHashMap.adoc[FlatHashMap]::FlatHashMap
:relfileprefix: ../../../
:mrdocs:

Constructors

== Synopses

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

Create an empty `FlatHashMap` object&period; Optionally specify a `capacity` indicating the minimum initial size of the underlying array of entries of this container&period; If `capacity` is not supplied or is 0, no memory is allocated&period; Optionally specify a `hash` functor used to generate the hash values associated with the keys of elements in this container&period; If `hash` is not supplied, a default&hyphen;constructed object of the (template parameter) type `HASH` is used&period; Optionally specify an equality functor `equal` used to determine whether the keys of two elements are equivalent&period; If `equal` is not supplied, a default&hyphen;constructed object of the (template parameter) type `EQUAL` is used&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not supplied or is 0, the currently installed default allocator is used&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-07.adoc[FlatHashMap]();
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-07.adoc[_» more&period;&period;&period;_]#

Create an empty map with at least the specified `capacity`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:BloombergLP/bdlc/FlatHashMap/2constructor-01.adoc[FlatHashMap](std::size&lowbar;t capacity);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-01.adoc[_» more&period;&period;&period;_]#

Create a `FlatHashMap` object having the same value, hasher, equality comparator, and allocator as the specified `original` object&period; The contents of `original` are moved (in constant time) to this object, `original` is left in a (valid) unspecified state, and no exceptions will be thrown&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-0fc.adoc[FlatHashMap](xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;FlatHashMap&gt;] original);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-0fc.adoc[_» more&period;&period;&period;_]#

Create an empty map using the specified `basicAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:BloombergLP/bdlc/FlatHashMap/2constructor-0e1.adoc[FlatHashMap](xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-0e1.adoc[_» more&period;&period;&period;_]#

Create an empty map with at least the specified `capacity`, using the specified `basicAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-0a4.adoc[FlatHashMap](
    std::size&lowbar;t capacity,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-0a4.adoc[_» more&period;&period;&period;_]#

Create a `FlatHashMap` object having the same value, hasher, and equality comparator as the specified `original` object, using the specified `basicAllocator` to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period; The allocator of `original` remains unchanged&period; If `original` and the newly created object have the same allocator then the contents of `original` are moved (in constant time) to this object, `original` is left in a (valid) unspecified state, and no exceptions will be thrown&semi; otherwise, `original` is unchanged (and an exception may be thrown)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-03.adoc[FlatHashMap](
    xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;FlatHashMap&gt;] original,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator);
----

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

Create a `FlatHashMap` object initialized by insertion of the specified `values`&period; Optionally specify a `capacity` indicating the minimum initial size of the underlying array of entries of this container&period; If `capacity` is not supplied or is 0, no memory is allocated&period; Optionally specify a `hash` functor used to generate hash values associated with the keys of elements in this container&period; If `hash` is not supplied, a default&hyphen;constructed object of the (template parameter) type `HASH` is used&period; Optionally specify an equality functor `equal` used to determine whether the keys of two elements are equivalent&period; If `equal` is not supplied, a default&hyphen;constructed object of the (template parameter) type `EQUAL` is used&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not supplied or is 0, the currently installed default allocator is used&period; Note that if a member of `values` has an equivalent key to an earlier member, the later member will not be inserted&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-0fa.adoc[FlatHashMap](
    bsl::initializer&lowbar;list&lt;value&lowbar;type&gt; values,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-0fa.adoc[_» more&period;&period;&period;_]#

Create a `FlatHashMap` object having the same value, hasher, and equality comparator as the specified `original` object&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not specified or is 0, the currently installed default allocator is used&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-06a.adoc[FlatHashMap](
    xref:BloombergLP/bdlc/FlatHashMap.adoc[FlatHashMap] const& original,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-06a.adoc[_» more&period;&period;&period;_]#

Create an empty map with at least the specified `capacity` and `hash` functor&semi; optionally use `basicAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-051.adoc[FlatHashMap](
    std::size&lowbar;t capacity,
    HASH const& hash,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-051.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, also requesting at least the specified `capacity`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-0e8.adoc[FlatHashMap](
    bsl::initializer&lowbar;list&lt;value&lowbar;type&gt; values,
    std::size&lowbar;t capacity,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-0e8.adoc[_» more&period;&period;&period;_]#

Create a `FlatHashMap` object initialized by insertion of the values from the input iterator range specified by `first` through `last` (including `first`, excluding `last`)&period; Optionally specify a `capacity` indicating the minimum initial size of the underlying array of entries of this container&period; If `capacity` is not supplied or is 0, no memory is allocated&period; Optionally specify a `hash` functor used to generate hash values associated with the keys of the elements in this container&period; If `hash` is not supplied, a default&hyphen;constructed object of the (template parameter) type `HASH` is used&period; Optionally specify an equality functor `equal` used to determine whether the keys of two elements are equivalent&period; If `equal` is not supplied, a default&hyphen;constructed object of the (template parameter) type `EQUAL` is used&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not supplied or is 0, the currently installed default allocator is used&period; The behavior is undefined unless `first` and `last` refer to a sequence of valid values where `first` is at a position at or before `last`&period; Note that if a member of the input sequence has an equivalent key to an earlier member, the later member will not be inserted&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:BloombergLP/bdlc/FlatHashMap/2constructor-06c.adoc[FlatHashMap](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-06c.adoc[_» more&period;&period;&period;_]#

Create an empty map with at least the specified `capacity`, `hash`, and `equal` predicate&semi; optionally use `basicAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-0c.adoc[FlatHashMap](
    std::size&lowbar;t capacity,
    HASH const& hash,
    EQUAL const& equal,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-0c.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, also using the specified `hash`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-00.adoc[FlatHashMap](
    bsl::initializer&lowbar;list&lt;value&lowbar;type&gt; values,
    std::size&lowbar;t capacity,
    HASH const& hash,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

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

Same as the preceding overload, also requesting at least the specified `capacity`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:BloombergLP/bdlc/FlatHashMap/2constructor-0d4.adoc[FlatHashMap](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    std::size&lowbar;t capacity,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-0d4.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, also using the specified `equal`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlc/FlatHashMap/2constructor-0af.adoc[FlatHashMap](
    bsl::initializer&lowbar;list&lt;value&lowbar;type&gt; values,
    std::size&lowbar;t capacity,
    HASH const& hash,
    EQUAL const& equal,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-0af.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, also using the specified `hash`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:BloombergLP/bdlc/FlatHashMap/2constructor-0d7.adoc[FlatHashMap](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    std::size&lowbar;t capacity,
    HASH const& hash,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

[.small]#xref:BloombergLP/bdlc/FlatHashMap/2constructor-0d7.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, also using the specified `equal`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:BloombergLP/bdlc/FlatHashMap/2constructor-08.adoc[FlatHashMap](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    std::size&lowbar;t capacity,
    HASH const& hash,
    EQUAL const& equal,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

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


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