[#bsl-map-0a7-try_emplace-0b7]
= xref:bsl.adoc[bsl]::xref:bsl/map-0a7.adoc[map]::try&lowbar;emplace
:relfileprefix: ../../
:mrdocs:

Try to emplace an element with `key` near `hint`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class&period;&period;&period; Args&gt;
xref:bsl/map-0a7/iterator.adoc[map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::iterator]
try&lowbar;emplace(
    xref:bsl/map-0a7/const_iterator.adoc[const&lowbar;iterator] hint,
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;KEY&gt;] key,
    Args&&&period;&period;&period; args);
----

== Description

Insert at the specified `hint` using a movable `key` and the specified constructor `args`, or return an iterator to an existing entry&period;

== Return Value

iterator to the existing or newly inserted element

== Parameters

[cols="1,4"]
|===
| Name| Description
| *hint*
| iterator hint for the insertion position
| *key*
| key for the element to emplace
| *args*
| constructor arguments for the mapped value
|===


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