[#BloombergLP-bslstl-HashTable-tryEmplace-09]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/HashTable.adoc[HashTable]::tryEmplace
:relfileprefix: ../../../
:mrdocs:

Emplace a value for a movable `key` if missing&semi; otherwise return existing&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class&period;&period;&period; ARGS&gt;
xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]*
tryEmplace(
    bool* isInsertedFlag,
    xref:BloombergLP/bslalg/BidirectionalLink.adoc[bslalg::BidirectionalLink]* hint,
    xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;NonConstKeyType&gt;] key,
    ARGS&&&period;&period;&period; args);
----

== Description

If a key equivalent to the specified `key` already exists in this hash&hyphen;table, load `false` into the specified `isInsertedFlag` and return a pointer to the existing entry&period; Otherwise, insert into this hash&hyphen;table a newly&hyphen;created `value&lowbar;type` object, constructed from `std&colon;&colon;forward&lt;KEY&gt;(key)` and the specified `args`, load `true` into `isInsertedFlag` and return a pointer to the newly created entry&period; Use the optionally specified `hint` as a starting place for the search for the existing key&period;

== Return Value

pointer to the existing or newly created entry

== Parameters

[cols="1,4"]
|===
| Name| Description
| *isInsertedFlag*
| set to `true` if a new entry was inserted
| *hint*
| optional starting node for the key search
| *key*
| movable key used to find or insert an entry
| *args*
| arguments used to construct the mapped value
|===


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