try_emplace overloads

Synopses

Declared in <bdlc_flathashmap.h>

Try to emplace an element with the specified key.

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);

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;

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

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);

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;

Return Value

  • pair of iterator to the element and whether insertion occurred

  • iterator to the existing or newly inserted element

Parameters

Name

Description

key

key of the element to emplace (may be moved from)

args

arguments forwarded to construct the mapped value

hint

iterator hint (ignored)

Created with MrDocs