[#bsl-map-0a7-2constructor-0bc]
= xref:bsl.adoc[bsl]::xref:bsl/map-0a7.adoc[map]::map
:relfileprefix: ../../
:mrdocs:

Constructors

== Synopses

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

Create an empty map&period; Optionally specify a `comparator` used to order key&hyphen;value pairs contained in this object&period; If `comparator` is not supplied, a default&hyphen;constructed object of the (template parameter) type `COMPARATOR` is used&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` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma&colon;&colon;Allocator &ast;`&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/map-0a7/2constructor-098.adoc[map]();
----

[.small]#xref:bsl/map-0a7/2constructor-098.adoc[_» more&period;&period;&period;_]#

Create a map having the same value as the specified `original` object&period; Use a copy of `original&period;key&lowbar;comp()` to order the key&hyphen;value pairs contained in this map&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;get&lowbar;allocator())&apos; to allocate memory&period; If the (template parameter) type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default), the currently installed default allocator is used&period; This method requires that the (template parameter) types `KEY` and `VALUE` both be `copy&hyphen;insertable` into this map (see &lcub;Requirements on `KEY` and `VALUE`&rcub;)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/map-0a7/2constructor-06.adoc[map](xref:bsl/map-0a7.adoc[map] const& original);
----

[.small]#xref:bsl/map-0a7/2constructor-06.adoc[_» more&period;&period;&period;_]#

Create a map having the same value as the specified `original` object by moving (in constant time) the contents of `original` to the new map&period; Use a copy of `original&period;key&lowbar;comp()` to order the key&hyphen;value pairs contained in this map&period; The allocator associated with `original` is propagated for use in the newly&hyphen;created map&period; `original` is left in a valid but unspecified state&period;


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

[.small]#xref:bsl/map-0a7/2constructor-0e.adoc[_» more&period;&period;&period;_]#

Create an empty map that uses the specified `basicAllocator` to supply memory&period; Use a default&hyphen;constructed object of the (template parameter) type `COMPARATOR` to order the key&hyphen;value pairs contained in this map&period; 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"]
----
explicit
xref:bsl/map-0a7/2constructor-0c.adoc[map](ALLOCATOR const& basicAllocator);
----

[.small]#xref:bsl/map-0a7/2constructor-0c.adoc[_» more&period;&period;&period;_]#

Create a map having the same value 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 map 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;key&lowbar;comp()` to order the key&hyphen;value pairs contained in this map&period; This method requires that the (template parameter) types `KEY` and `VALUE` both be `move&hyphen;insertable` into this map (see &lcub;Requirements on `KEY` and `VALUE`&rcub;)&period; 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:bsl/map-0a7/2constructor-008.adoc[map](
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;map&gt;] original,
    ALLOCATOR const& basicAllocator);
----

[.small]#xref:bsl/map-0a7/2constructor-008.adoc[_» more&period;&period;&period;_]#

Create a map containing the elements from the specified `values` initializer list, using the specified `basicAllocator` to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/map-0a7/2constructor-090.adoc[map](
    std::initializer&lowbar;list&lt;value&lowbar;type&gt; values,
    ALLOCATOR const& basicAllocator);
----

[.small]#xref:bsl/map-0a7/2constructor-090.adoc[_» more&period;&period;&period;_]#

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


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:bsl/map-0a7/2constructor-01a.adoc[map](
    COMPARATOR const& comparator,
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/map-0a7/2constructor-01a.adoc[_» more&period;&period;&period;_]#

Create a map having the same value as the specified `original` object that uses the specified `basicAllocator` to supply memory&period; Use a copy of `original&period;key&lowbar;comp()` to order the key&hyphen;value pairs contained in this map&period; This method requires that the (template parameter) types `KEY` and `VALUE` both be `copy&hyphen;insertable` into this map (see &lcub;Requirements on `KEY` and `VALUE`&rcub;)&period; 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:bsl/map-0a7/2constructor-016.adoc[map](
    xref:bsl/map-0a7.adoc[map] const& original,
    ALLOCATOR const& basicAllocator);
----

[.small]#xref:bsl/map-0a7/2constructor-016.adoc[_» more&period;&period;&period;_]#

Create a map and insert each `value&lowbar;type` object in the specified `values` initializer list, ignoring those objects having a key equivalent to that which appears earlier in the list&period; Optionally specify a `comparator` used to order keys contained in this object&period; If `comparator` is not supplied, a default&hyphen;constructed object of the (template parameter) type `COMPARATOR` is used&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` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma&colon;&colon;Allocator &ast;`&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period; If `values` is ordered according to `comparator`, then this operation has `O&lsqb;N&rsqb;` complexity, where `N` is the number of elements in `values`&semi; otherwise, this operation has `O&lsqb;N &ast; log(N)&rsqb;` complexity&period; This method requires that the (template parameter) types `KEY` and `VALUE` both be `copy&hyphen;insertable` into this map (see &lcub;Requirements on `KEY` and `VALUE`&rcub;)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/map-0a7/2constructor-0ba.adoc[map](
    std::initializer&lowbar;list&lt;value&lowbar;type&gt; values,
    COMPARATOR const& comparator = COMPARATOR(),
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/map-0a7/2constructor-0ba.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, omitting `comparator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:bsl/map-0a7/2constructor-0f.adoc[map](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    ALLOCATOR const& basicAllocator);
----

[.small]#xref:bsl/map-0a7/2constructor-0f.adoc[_» more&period;&period;&period;_]#

Create a map having the (`value&lowbar;type`) values obtained from the specified `range`, using the specified `basicAllocator` to supply memory&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class RANGE&gt;
xref:bsl/map-0a7/2constructor-03.adoc[map](
    std::from&lowbar;range&lowbar;t,
    RANGE&& range,
    ALLOCATOR const& basicAllocator);
----

[.small]#xref:bsl/map-0a7/2constructor-03.adoc[_» more&period;&period;&period;_]#

Create a map, and insert each `value&lowbar;type` object in the sequence starting at the specified `first` element, and ending immediately before the specified `last` element, ignoring those objects having a key equivalent to that which appears earlier in the sequence&period; Optionally specify a `comparator` used to order key&hyphen;value pairs contained in this object&period; If `comparator` is not supplied, a default&hyphen;constructed object of the (template parameter) type `COMPARATOR` is used&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` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma&colon;&colon;Allocator &ast;`&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period; If the sequence `first` to `last` is ordered according to `comparator`, then this operation has `O&lsqb;N&rsqb;` complexity, where `N` is the number of elements between `first` and `last`&semi; otherwise, this operation has `O&lsqb;N &ast; log(N)&rsqb;` complexity&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:bsl/map-0a7/2constructor-0a.adoc[map](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    COMPARATOR const& comparator = COMPARATOR(),
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/map-0a7/2constructor-0a.adoc[_» more&period;&period;&period;_]#

Create a map having the (`value&lowbar;type`) values obtained from the specified `range`&period; Ignore those those objects having a key equivalent to that which appears earlier in the sequence&period; Optionally specify a `comparator` used to order key&hyphen;value pairs contained in this object&period; If `comparator` is not supplied, a default&hyphen;constructed object of the (template parameter) type `COMPARATOR` is used&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` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma&colon;&colon;Allocator &ast;`&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period; If values obtained from &grave;range are ordered according to `comparator`, then this operation has `O&lsqb;N&rsqb;` complexity, where `N` is the number of values in the `range`&semi; otherwise, this operation has `O&lsqb;N &ast; log(N)&rsqb;` complexity&period; Note that `RANGE` must meet the requirements of an input range and the values from `range` must have a type matching or convertible to `value&lowbar;type`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class RANGE&gt;
xref:bsl/map-0a7/2constructor-001.adoc[map](
    std::from&lowbar;range&lowbar;t,
    RANGE&& range,
    COMPARATOR const& comparator = COMPARATOR(),
    ALLOCATOR const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/map-0a7/2constructor-001.adoc[_» more&period;&period;&period;_]#


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