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

`try&lowbar;emplace` overloads

== Synopses

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

If a key equivalent to the specified `key` already exists in this map, return a pair containing an iterator referring to the existing item, and `false`&period; Otherwise, insert into this map a newly&hyphen;created `ENTRY` object, constructed from `std&colon;&colon;forward&lt;KEY&gt;(key)` and the specified `args`, and return a pair containing an iterator referring to the newly&hyphen;created entry and `true`&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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class&period;&period;&period; ARGS&gt;
xref:bsl/pair-0b.adoc[bsl::pair&lt;FlatHashTable&lt;KEY, ENTRY, ENTRY&lowbar;UTIL, HASH, EQUAL&gt;::iterator, bool&gt;]
xref:BloombergLP/bdlc/FlatHashTable/try_emplace-08.adoc[try&lowbar;emplace](
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;KEY&gt;] key,
    ARGS&&&period;&period;&period; args);
----

[.small]#xref:BloombergLP/bdlc/FlatHashTable/try_emplace-08.adoc[_» more&period;&period;&period;_]#

If a key equivalent to the specified `key` already exists in this map, return a pair containing an iterator referring to the existing item, and `false`&period; Otherwise, insert into this map a newly&hyphen;created `ENTRY` object, constructed from `key` and the specified `args`, and return a pair containing an iterator referring to the newly&hyphen;created entry and `true`&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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class&period;&period;&period; ARGS&gt;
xref:bsl/pair-0b.adoc[bsl::pair&lt;FlatHashTable&lt;KEY, ENTRY, ENTRY&lowbar;UTIL, HASH, EQUAL&gt;::iterator, bool&gt;]
xref:BloombergLP/bdlc/FlatHashTable/try_emplace-00.adoc[try&lowbar;emplace](
    KEY const& key,
    ARGS&&&period;&period;&period; args);
----

[.small]#xref:BloombergLP/bdlc/FlatHashTable/try_emplace-00.adoc[_» more&period;&period;&period;_]#

If a key equivalent to the specified `key` already exists in this map return a pair containing an iterator referring to the existing item, and `false`&period; Otherwise, insert into this map a newly&hyphen;created `ENTRY` object, constructed from `std&colon;&colon;forward&lt;LOOKUP&lowbar;KEY&gt;(k)` and the specified `args`, and return a pair containing an iterator referring to the newly&hyphen;created entry and `true`&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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class LOOKUP&lowbar;KEY,
    class&period;&period;&period; ARGS&gt;
xref:bsl/pair-0b.adoc[bsl::pair&lt;iterator, bool&gt;]
xref:BloombergLP/bdlc/FlatHashTable/try_emplace-0d.adoc[try&lowbar;emplace](
    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;
----

[.small]#xref:BloombergLP/bdlc/FlatHashTable/try_emplace-0d.adoc[_» more&period;&period;&period;_]#


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