[#bsl-unordered_map-02b-try_emplace-0f]
= xref:bsl.adoc[bsl]::xref:bsl/unordered_map-02b.adoc[unordered&lowbar;map]::try&lowbar;emplace
:relfileprefix: ../../
:mrdocs:

Emplace with transparent lookup key at `hint`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class LOOKUP&lowbar;KEY,
    class&period;&period;&period; Args&gt;
xref:bsl/unordered_map-02b/iterator.adoc[iterator]
try&lowbar;emplace(
    xref:bsl/unordered_map-02b/const_iterator.adoc[const&lowbar;iterator] hint,
    LOOKUP&lowbar;KEY&& key,
    Args&&&period;&period;&period; args)
requires BloombergLP&colon;&colon;bslmf&colon;&colon;IsTransparentPredicate&lt;HASH, LOOKUP&lowbar;KEY&gt;&colon;&colon;value
        &amp;&amp; BloombergLP&colon;&colon;bslmf&colon;&colon;IsTransparentPredicate&lt;EQUAL,LOOKUP&lowbar;KEY&gt;&colon;&colon;value;
----

== Description

If a key equivalent to the specified `key` already exists in this unordered&lowbar;map, return an iterator referring to the existing item&period; Otherwise, insert into this map a newly&hyphen;created `value&lowbar;type` object, constructed from `std&colon;&colon;forward&lt;LOOKUP&lowbar;KEY&gt;(key)` and the specified `args`, and return an iterator referring to the newly&hyphen;created entry&period; Use the specified `hint` as a starting point for checking to see if the key already in the unordered&lowbar;map&period; This method requires that the (template parameter) types `KEY` and `VALUE` are `emplace&hyphen;constructible` from `key` and `args` respectively&period; For C&plus;&plus;03, `VALUE` must also be `copy&hyphen;constructible`&period;

Note&colon; implemented inline due to Sun CC compilation error&period;

== Return Value

iterator to the existing or newly inserted element

== Parameters

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


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