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

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

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/map-0a7/iterator.adoc[map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator]
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);
----

== Description

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

Insert into this map the specified `value` (in amortized constant time if the specified `hint` is a valid immediate successor to `value`) if a key (the `first` element) equivalent to that of `value` does not already exist in this map&semi; otherwise, this method has no effect&period; Return an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this map whose key is equivalent to that of `value`&period; If `hint` is not a valid immediate successor to `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;)&period; The behavior is undefined unless `hint` is an iterator in the range `&lsqb;begin() &period;&period; end()&rsqb;` (both endpoints included)&period;

== Return Value

iterator to the existing or newly inserted element

== Parameters

[cols="1,4"]
|===
| Name| Description
| *hint*
| iterator hint for the insertion position
| *value*
| element to move&hyphen;insert
|===


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