Invoke visitor on the value of every element matching key.

Synopsis

Declared in <bdlcc_stripedunorderedmultimap.h>

int
setComputedValueAll(
    KEY const& key,
    VisitorFunction const& visitor);

Description

Serially invoke the specified visitor passing the specified key, and the address of the value of each element in this hash map having key. If key is not in the map, value will be default constructed. That is, for each (key, value) found, invoke: ` bool visitor(VALUE *value, const Key& key); ` If no element in the map has key, insert (key, VALUE()) and invoke visitor with value pointing to the default constructed value. Return the number of elements visited or the negation of that value if visitations stopped because visitor returned false. visitor, when invoked, has exclusive access (i.e., write access) to each element during each invocation. The behavior is undefined if hash map manipulators and getValue* methods are invoked from within visitor, as it may lead to a deadlock. Note that the setComputedValueFirst method is more performant than the when the hash map contains a single element for key. Also note that a return value of 0 implies that an element was inserted.

Return Value

number of elements visited, or its negation if stopped early

Parameters

Name

Description

key

key of the elements to update or insert

visitor

functor invoked with each matching value

Created with MrDocs