bsl::map::try_emplace

Try to emplace an element with key near hint.

Synopsis

Declared in <bslstl_map.h>

template<class... Args>
map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
try_emplace(
    const_iterator hint,
    BloombergLP::bslmf::MovableRef<KEY> key,
    Args&&... args);

Description

Insert at the specified hint using a movable key and the specified constructor args, or return an iterator to an existing entry.

Return Value

iterator to the existing or newly inserted element

Parameters

NameDescription
hintiterator hint for the insertion position
keykey for the element to emplace
argsconstructor arguments for the mapped value