BloombergLP::bdlcc::StripedUnorderedContainerImpl::setComputedValueFirst

Invoke the specified visitor passing the specified key, and the address of the value attribute of the first element (of possibly many elements) found in this hash map having key. If key is not in the map, value will be default constructed. That is, for (key, value), 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 defsult constructed value. Return 1 if key was found and visitor returned true, 0 if key was not found, and -1 if key was found and visitor returned false. visitor, when invoked, has exclusive access (i.e., write access) to the element. 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 return value equals the number of elements inserted. Also note that, when there are multiple elements having key, the selection of "first" is implementation specific and subject to change. Also note that this method is more performant than the setComputedValueAll method when the hash map contains a single element for key. Also note that a return value of 0 implies that an element was inserted.

Synopsis

Declared in <bdlcc_stripedunorderedcontainerimpl.h>

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