BloombergLP::bdlcc::StripedUnorderedMultiMap::setValueFirst

Set the first matching element's value by move, or insert one.

Synopsis

Declared in <bdlcc_stripedunorderedmultimap.h>

std::size_t
setValueFirst(
    KEY const& key,
    bslmf::MovableRef<VALUE> value);

Description

Set the value attribute of the first element in this hash map (of possibly many) found to have the specified key to the specified move-insertable value. If no such such element exists, insert (key, value). Return the number of elements found with key. The value object is left in a valid but unspecified state. If value is allocator-enabled and allocator() != value.allocator() this operation may cost as much as a copy. Note that if no elements were found, and a new value was inserted, 0 is returned. Also note that this method is more performant than setValueAll when there is one element having key in the hash map.

Return Value

number of elements found with key

Parameters

NameDescription
keykey of the element to set or insert
valuemove-insertable value to assign or insert