try_emplace overloads

Synopses

Declared in <bslstl_unorderedmap.h>

Emplace a value for movable key if missing.

template<class... Args>
pair<iterator, bool>
try_emplace(
    BloombergLP::bslmf::MovableRef<KEY> key,
    Args&&... args);

Emplace a value for key if no equivalent key already exists.

template<class... Args>
pair<iterator, bool>
try_emplace(
    KEY const& key,
    Args&&... args);

Emplace a value for transparent key if missing.

template<
    class LOOKUP_KEY,
    class... Args>
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
        && !bsl::is_convertible<LOOKUP_KEY&&, const_iterator>::value
        && !bsl::is_convertible<LOOKUP_KEY&&, iterator>::value;

Emplace a value for movable key at hint if missing.

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

Emplace a value for key at hint if missing.

template<class... Args>
iterator
try_emplace(
    const_iterator hint,
    KEY const& key,
    Args&&... args);

Emplace with transparent lookup key at 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

  • iterator to the element and whether insertion occurred

  • iterator to the existing or newly inserted element

Parameters

Name

Description

key

key to look up

args

constructor arguments for the new element

hint

iterator hint for insertion

Created with MrDocs