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

`try&lowbar;emplace` overloads

== Synopses

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

Try to emplace an element with the specified `key`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class&period;&period;&period; ARGS&gt;
xref:bsl/pair-0b.adoc[bsl::pair&lt;FlatHashMap&lt;KEY, VALUE, HASH, EQUAL&gt;::iterator, bool&gt;]
xref:BloombergLP/bdlc/FlatHashMap/try_emplace-06.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/FlatHashMap/try_emplace-06.adoc[_» more&period;&period;&period;_]#

Try to emplace an element with the specified `key`&period;


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

[.small]#xref:BloombergLP/bdlc/FlatHashMap/try_emplace-04c.adoc[_» more&period;&period;&period;_]#

Try to emplace an element with the specified `key`&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/FlatHashMap/try_emplace-0b.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/FlatHashMap/try_emplace-0b.adoc[_» more&period;&period;&period;_]#

Try to emplace an element with `key` using a placement hint&period;


[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]
xref:BloombergLP/bdlc/FlatHashMap/try_emplace-041.adoc[try&lowbar;emplace](
    xref:BloombergLP/bdlc/FlatHashMap/const_iterator.adoc[const&lowbar;iterator] hint,
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;KEY&gt;] key,
    ARGS&&&period;&period;&period; args);
----

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

Try to emplace an element with `key` using a placement hint&period;


[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]
xref:BloombergLP/bdlc/FlatHashMap/try_emplace-01.adoc[try&lowbar;emplace](
    xref:BloombergLP/bdlc/FlatHashMap/const_iterator.adoc[const&lowbar;iterator] hint,
    KEY const& key,
    ARGS&&&period;&period;&period; args);
----

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

Try to emplace an element with `key` using a placement hint&period;


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

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

== Return Value

* pair of iterator to the element and whether insertion occurred
* iterator to the existing or newly inserted element

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key*
| key of the element to emplace (may be moved from)
| *args*
| arguments forwarded to construct the mapped value
| *hint*
| iterator hint (ignored)
|===


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