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

Insert into this map a `value&lowbar;type` object created from the specified `value` (in amortized constant time if the specified `hint` is a valid immediate successor to the object created from `value`) if a key (the `first` element) equivalent to such an object does not already exist in this map&semi; otherwise, this method has no effect (other than possibly creating a temporary `value&lowbar;type` object)&period; Return an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this map whose key is equivalent to that of the object created from `value`&period; If `hint` is not a valid immediate successor to the object created from `value`, this operation has `O&lsqb;log(N)&rsqb;` complexity, where `N` is the size of 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;), and the `value&lowbar;type` be constructible from the (template parameter) `ALT&lowbar;VALUE&lowbar;TYPE`&period; The behavior is undefined unless `hint` is an iterator in the range `&lsqb;begin() &period;&period; end()&rsqb;` (both endpoints included)&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALT&lowbar;VALUE&lowbar;TYPE&gt;
xref:bsl/map-0a7/iterator.adoc[iterator]
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]#Created with https://www.mrdocs.com[MrDocs]#
