bsl::map::try_emplace

Try to emplace an element with transparent key near hint.

Synopsis

Declared in <bslstl_map.h>

template<
    class LOOKUP_KEY,
    class... Args>
iterator
try_emplace(
    const_iterator hint,
    LOOKUP_KEY&& key,
    Args&&... args)
requires BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
                                                   LOOKUP_KEY>::value;

Description

Insert at the specified hint using the transparent LOOKUP_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
keytransparent key for the element to emplace
argsconstructor arguments for the mapped value