BloombergLP::bdlc::FlatHashMap::try_emplace

try_emplace overloads

Synopses

Declared in <bdlc_flathashmap.h>

Try to emplace an element with the specified key.

template<class... ARGS>
bsl::pair<FlatHashMap<KEY, VALUE, HASH, EQUAL>::iterator, bool>
try_emplace(
    BloombergLP::bslmf::MovableRef<KEY> key,
    ARGS&&... args);
» more...

Try to emplace an element with the specified key.

template<class... ARGS>
bsl::pair<FlatHashMap<KEY, VALUE, HASH, EQUAL>::iterator, bool>
try_emplace(
    KEY const& key,
    ARGS&&... args);
» more...

Try to emplace an element with the specified key.

template<
    class LOOKUP_KEY,
    class... ARGS>
bsl::pair<iterator, bool>
try_emplace(
    LOOKUP_KEY&& key,
    ARGS&&... args)
requires BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
         && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value;
» more...

Try to emplace an element with key using a placement hint.

template<class... ARGS>
FlatHashMap<KEY, VALUE, HASH, EQUAL>::iterator
try_emplace(
    const_iterator hint,
    BloombergLP::bslmf::MovableRef<KEY> key,
    ARGS&&... args);
» more...

Try to emplace an element with key using a placement hint.

template<class... ARGS>
FlatHashMap<KEY, VALUE, HASH, EQUAL>::iterator
try_emplace(
    const_iterator hint,
    KEY const& key,
    ARGS&&... args);
» more...

Try to emplace an element with key using a placement hint.

template<
    class LOOKUP_KEY,
    class... ARGS>
iterator
try_emplace(
    const_iterator hint,
    LOOKUP_KEY&& key,
    ARGS&&... args)
requires BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
         && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value;
» more...

Return Value

  • pair of iterator to the element and whether insertion occurred
  • iterator to the existing or newly inserted element

Parameters

NameDescription
keykey of the element to emplace (may be moved from)
argsarguments forwarded to construct the mapped value
hintiterator hint (ignored)