[#bsl-map-0a7-try_emplace-0c] = xref:bsl.adoc[bsl]::xref:bsl/map-0a7.adoc[map]::try_emplace :relfileprefix: ../../ :mrdocs: `try_emplace` overloads == Synopses Declared in `<bslstl_map.h>` Try to emplace an element with a movable `key`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Args> xref:bsl/pair-0b.adoc[pair<map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>] xref:bsl/map-0a7/try_emplace-0de.adoc[try_emplace]( xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<KEY>] key, Args&&... args); ---- [.small]#xref:bsl/map-0a7/try_emplace-0de.adoc[_» more..._]# Try to emplace an element with `key` constructed from `args`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Args> xref:bsl/pair-0b.adoc[pair<map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>] xref:bsl/map-0a7/try_emplace-0be.adoc[try_emplace]( KEY const& key, Args&&... args); ---- [.small]#xref:bsl/map-0a7/try_emplace-0be.adoc[_» more..._]# Try to emplace an element with transparent `key`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class LOOKUP_KEY, class... Args> xref:bsl/pair-0b.adoc[pair<iterator, bool>] xref:bsl/map-0a7/try_emplace-08.adoc[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; ---- [.small]#xref:bsl/map-0a7/try_emplace-08.adoc[_» more..._]# Try to emplace an element with `key` near `hint`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Args> xref:bsl/map-0a7/iterator.adoc[map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator] xref:bsl/map-0a7/try_emplace-0b7.adoc[try_emplace]( xref:bsl/map-0a7/const_iterator.adoc[const_iterator] hint, xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<KEY>] key, Args&&... args); ---- [.small]#xref:bsl/map-0a7/try_emplace-0b7.adoc[_» more..._]# Try to emplace an element with `key` near `hint`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class... Args> xref:bsl/map-0a7/iterator.adoc[map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator] xref:bsl/map-0a7/try_emplace-0d6.adoc[try_emplace]( xref:bsl/map-0a7/const_iterator.adoc[const_iterator] hint, KEY const& key, Args&&... args); ---- [.small]#xref:bsl/map-0a7/try_emplace-0d6.adoc[_» more..._]# Try to emplace an element with transparent `key` near `hint`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class LOOKUP_KEY, class... Args> xref:bsl/map-0a7/iterator.adoc[iterator] xref:bsl/map-0a7/try_emplace-04.adoc[try_emplace]( xref:bsl/map-0a7/const_iterator.adoc[const_iterator] hint, LOOKUP_KEY&& key, Args&&... args) requires BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR, LOOKUP_KEY>::value; ---- [.small]#xref:bsl/map-0a7/try_emplace-04.adoc[_» more..._]# == Return Value * pair of iterator and whether a new element was inserted * iterator to the existing or newly inserted element == Parameters [cols="1,4"] |=== | Name| Description | *key* | key to move into the new element | *args* | constructor arguments for the mapped value | *hint* | iterator hint for the insertion position |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#