[#bsl-unordered_map-02b-insert-021]
= xref:bsl.adoc[bsl]::xref:bsl/unordered_map-02b.adoc[unordered&lowbar;map]::insert
:relfileprefix: ../../
:mrdocs:

Insert `value` at `hint` if its key is not already present&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALT&lowbar;VALUE&lowbar;TYPE&gt;
xref:bsl/unordered_map-02b/iterator.adoc[iterator]
insert(
    xref:bsl/unordered_map-02b/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;
----

== Description

Insert the specified `value` into this unordered map if the key (the `first` element) of the object referred to by `value` does not already exist in this unordered map&semi; otherwise, this method has no effect (a `value&lowbar;type` object having the same key as the converted `value` already exists in this unordered map) &period; Return an iterator referring to ether the newly inserted) `value&lowbar;type` object or to the existing object whose key is equivalent to the key of `value`&period; The average and worst case complexity of this operation is not affected by the specified `hint`&period; This method requires that the (template parameter) types `KEY` and `VALUE` both be `move&hyphen;constructible` (see &lcub;Requirements on `value&lowbar;type`&rcub;) and that 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; Note that `hint` is ignored (other than possibly asserting its validity in some build modes)&period; Also note that this one template stands in for three `insert` functions in the C&plus;&plus;11 standard&period;

== Return Value

iterator to the existing or newly inserted element

== Parameters

[cols="1,4"]
|===
| Name| Description
| *hint*
| iterator hint for insertion
| *value*
| value to insert
|===


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