[#BloombergLP-bdlc-FlatHashMap-try_emplace-01]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::xref:BloombergLP/bdlc/FlatHashMap.adoc[FlatHashMap]::try&lowbar;emplace
:relfileprefix: ../../../
:mrdocs:

If a key equivalent to the specified `key` already exists in this 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 `key` and the specified `args`, and return an iterator referring to the newly&hyphen;created entry&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;

== Synopsis

Declared in `&lt;bdlc&lowbar;flathashmap&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class&period;&period;&period; ARGS&gt;
xref:BloombergLP/bdlc/FlatHashMap/iterator.adoc[FlatHashMap&lt;KEY, VALUE, HASH, EQUAL&gt;::iterator]
try&lowbar;emplace(
    xref:BloombergLP/bdlc/FlatHashMap/const_iterator.adoc[const&lowbar;iterator],
    KEY const& key,
    ARGS&&&period;&period;&period; args);
----


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