BloombergLP::bdlc::FlatHashMap::insert_or_assign

Insert or assign the mapped value for the specified key.

Synopsis

Declared in <bdlc_flathashmap.h>

template<class M>
bsl::pair<FlatHashMap<KEY, VALUE, HASH, EQUAL>::iterator, bool>
insert_or_assign(
    BloombergLP::bslmf::MovableRef<KEY> key,
    M&& obj);

Description

If this map contains an entry with a key equivalent to the specified key, assign the specified obj to the mapped_type of that entry, and return an iterator to that entry and false. Otherwise, insert a new entry into the map with the and return an iterator to that entry and true. obj is left in a (valid) unspecified state.

Return Value

pair of iterator to the element and true if inserted

Parameters

NameDescription
keykey to insert or update (may be moved from)
objmapped value to assign or move-insert