absl::linked_hash_map::insert_or_assign

insert_or_assign overloads

Synopses

Declared in <absl/container/linked_hash_map.h>

Inserts the given key/value, or assigns the value if the key exists.

template<
    class K = key_type,
    class V = mapped_type>
std::pair<iterator, bool>
insert_or_assign(
    key_arg<K> const& k,
    V const& v);
» more...

Inserts the given key/value, or assigns the value if the key exists.

template<
    class K = key_type,
    class V = mapped_type,
    V* = nullptr>
std::pair<iterator, bool>
insert_or_assign(
    key_arg<K> const& k,
    V&& v);
» more...

Inserts the given key/value, or assigns the value if the key exists.

template<
    class K = key_type,
    class V = mapped_type,
    K* = nullptr>
std::pair<iterator, bool>
insert_or_assign(
    key_arg<K>&& k,
    V const& v);
» more...

Inserts the given key/value, or assigns the value if the key exists.

template<
    class K = key_type,
    class V = mapped_type,
    K* = nullptr,
    V* = nullptr>
std::pair<iterator, bool>
insert_or_assign(
    key_arg<K>&& k,
    V&& v);
» more...

Inserts the given key/value, or assigns the value if the key exists, ignoring the position hint.

template<
    class K = key_type,
    class V = mapped_type>
iterator
insert_or_assign(
    const_iterator hint,
    key_arg<K> const& k,
    V const& v);
» more...

Inserts the given key/value, or assigns the value if the key exists, ignoring the position hint.

template<
    class K = key_type,
    class V = mapped_type,
    V* = nullptr>
iterator
insert_or_assign(
    const_iterator hint,
    key_arg<K> const& k,
    V&& v);
» more...

Inserts the given key/value, or assigns the value if the key exists, ignoring the position hint.

template<
    class K = key_type,
    class V = mapped_type,
    K* = nullptr>
iterator
insert_or_assign(
    const_iterator hint,
    key_arg<K>&& k,
    V const& v);
» more...

Inserts the given key/value, or assigns the value if the key exists, ignoring the position hint.

template<
    class K = key_type,
    class V = mapped_type,
    K* = nullptr,
    V* = nullptr>
iterator
insert_or_assign(
    const_iterator hint,
    key_arg<K>&& k,
    V&& v);
» more...

Return Value

  • A pair of an iterator to the element and a bool that is true if insertion took place.
  • An iterator to the inserted or updated element.

Parameters

NameDescription
kThe key to insert or look up.
vThe value to assign.
hintA position hint, which is ignored.