[#bsl-map-0a7-try_emplace-08] = xref:bsl.adoc[bsl]::xref:bsl/map-0a7.adoc[map]::try_emplace :relfileprefix: ../../ :mrdocs: Try to emplace an element with transparent `key`. == Synopsis Declared in `<bslstl_map.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class LOOKUP_KEY, class... Args> xref:bsl/pair-0b.adoc[pair<iterator, bool>] try_emplace( LOOKUP_KEY&& key, Args&&... args) requires BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR, LOOKUP_KEY>::value && !bsl::is_convertible<LOOKUP_KEY&&, const_iterator>::value && !bsl::is_convertible<LOOKUP_KEY&&, iterator>::value; ---- == Description 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`. Otherwise, insert into this map a newly‐created entry constructed from `key` and the specified `args`, and return a pair containing an iterator referring to the newly‐created entry and `true`. This overload participates in overload resolution only when `LOOKUP_KEY` is a transparent lookup key for `COMPARATOR`. == Return Value pair of iterator and whether a new element was inserted == Parameters [cols="1,4"] |=== | Name| Description | *key* | transparent key for the element to emplace | *args* | constructor arguments for the mapped value |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#