BloombergLP::bdlc::FlatHashTable::try_emplace

Insert a newly constructed entry for key unless an equivalent key exists.

Synopses

Declared in <bdlc_flathashtable.h>

Insert a newly constructed entry for key unless an equivalent key exists.

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

Insert a newly constructed entry for key unless an equivalent key exists.

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

Insert a newly constructed entry for key unless an equivalent key exists.

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...

Return Value

pair of iterator to the entry and true if inserted

Parameters

NameDescription
keykey used to find or construct the entry
argsarguments forwarded to construct the mapped value