[#bsl-map-0a7-insert-03]
= xref:bsl.adoc[bsl]::xref:bsl/map-0a7.adoc[map]::insert
:relfileprefix: ../../
:mrdocs:

`insert` overloads

== Synopses

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

Insert a movable `value` if its key is absent&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/pair-0b.adoc[pair&lt;map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator, bool&gt;]
xref:bsl/map-0a7/insert-07.adoc[insert](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;value&lowbar;type&gt;] value);
----

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

Insert elements from `values` whose keys are not already present&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
xref:bsl/map-0a7/insert-0d.adoc[insert](std::initializer&lowbar;list&lt;value&lowbar;type&gt; values);
----

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

Insert a copy of `value` if its key is absent&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/pair-0b.adoc[pair&lt;map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator, bool&gt;]
xref:bsl/map-0a7/insert-000.adoc[insert](xref:bsl/map-0a7/value_type.adoc[value&lowbar;type] const& value);
----

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

Insert an element constructed from `value` if its key is absent&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALT&lowbar;VALUE&lowbar;TYPE&gt;
xref:bsl/pair-0b.adoc[pair&lt;iterator, bool&gt;]
xref:bsl/map-0a7/insert-029.adoc[insert](ALT&lowbar;VALUE&lowbar;TYPE&& value)
requires std&colon;&colon;is&lowbar;constructible&lt;value&lowbar;type,
                                             ALT&lowbar;VALUE&lowbar;TYPE&amp;&amp;&gt;&colon;&colon;value;
----

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

Insert a movable `value` near `hint` if its key is absent&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/map-0a7/iterator.adoc[map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator]
xref:bsl/map-0a7/insert-023.adoc[insert](
    xref:bsl/map-0a7/const_iterator.adoc[const&lowbar;iterator] hint,
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;value&lowbar;type&gt;] value);
----

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

Insert a copy of `value` near `hint` if its key is absent&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/map-0a7/iterator.adoc[map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator]
xref:bsl/map-0a7/insert-08.adoc[insert](
    xref:bsl/map-0a7/const_iterator.adoc[const&lowbar;iterator] hint,
    xref:bsl/map-0a7/value_type.adoc[value&lowbar;type] const& value);
----

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

Insert elements from `&lsqb;first, last)&rsqb;` whose keys are not already present&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
void
xref:bsl/map-0a7/insert-01.adoc[insert](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last);
----

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

Insert a convertible `value` near `hint` if its key is absent&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALT&lowbar;VALUE&lowbar;TYPE&gt;
xref:bsl/map-0a7/iterator.adoc[iterator]
xref:bsl/map-0a7/insert-005.adoc[insert](
    xref:bsl/map-0a7/const_iterator.adoc[const&lowbar;iterator] hint,
    ALT&lowbar;VALUE&lowbar;TYPE&& value)
requires std&colon;&colon;is&lowbar;constructible&lt;value&lowbar;type,
                                             ALT&lowbar;VALUE&lowbar;TYPE&amp;&amp;&gt;&colon;&colon;value;
----

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

== Return Value

* pair of iterator and whether a new element was inserted
* iterator to the existing or newly inserted element

== Parameters

[cols="1,4"]
|===
| Name| Description
| *value*
| element to move&hyphen;insert
| *values*
| initializer list of elements to insert
| *hint*
| iterator hint for the insertion position
| *first*
| beginning of the range to insert
| *last*
| end of the range to insert
|===


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