Fully thread-safe striped hash multimap from KEY to VALUE.
Declared in <bdlcc_stripedunorderedmultimap.h>
template<
class KEY,
class VALUE,
class HASH = bsl::hash<KEY>,
class EQUAL = bsl::equal_to<KEY>>
class StripedUnorderedMultiMap;
This class template defines a fully thread-safe container that provides a mapping from keys (of template parameter type KEY) to their associated mapped values (of template parameter type VALUE).
The buckets of this hash map are guarded by numStripes reader-writer locks, a value specified on construction. Partitioning the buckets among several locks allows greater overall concurrency than a bsl::unordered_multimap object guarded by a single lock.
The interface is inspired by, but not identical to that of bsl::unordered_multimap. Notably absent are iterators, which are of limited practicality in the typical use case because they are readily invalidated when the map population is open to modification by multiple threads.
| Name | Description |
|---|---|
EraseIfValuePredicate | Alias for a predicate that selects values to erase. |
KVType | Value type of a bulk insert entry. |
ReadOnlyVisitorFunction | Alias for a read-only visitor over element values. |
VisitorFunction | Alias for a visitor that may modify element values. |
| Name | Description |
|---|---|
Unnamed enum | Default sizing constants for this multimap. |
| Name | Description |
|---|---|
StripedUnorderedMultiMap [constructor] | Constructors |
allocator | Return the allocator used by this hash map to supply memory. |
bucketCount | Return the number of buckets maintained by this hash map. |
bucketIndex | Return the bucket index where elements with key are inserted. |
bucketSize | Return the number of elements in the bucket at the specified index. |
clear | Remove all elements from this hash map. If rehash is in progress, block until it completes. |
disableRehash | Prevent future rehash until enableRehash is called. |
empty | Return true if this hash map contains no elements, and false otherwise. |
enableRehash | Allow rehashing to resume when the load factor is exceeded. |
equalFunction | Return a copy of the key-equality functor used by this hash map. |
eraseAll | Erase from this hash map the elements having the specified key. Return the number of elements erased. |
eraseAllIf | Erase from this hash map the elements having the specified key for which the specified predicate holds true. Return the number of elements erased. |
eraseBulkAll | Erase all elements whose keys fall in [first, last)]. |
eraseFirst | Erase the first element found with the specified key. |
eraseFirstIf | Erase the first element with key for which predicate is true. |
getValueAll | getValueAll overloads |
getValueFirst | Load into *value the first value found for the specified key. |
hashFunction | Return (a copy of) the unary hash functor used by this hash map. The return function will generate a hash value (of type std::size_t) for a KEY object. |
insert | insert overloads |
insertBulk | Insert key-value pairs from the range [first, last)]. |
isRehashEnabled | Return true if rehash is enabled, or false otherwise. |
loadFactor | Return the current size divided by the number of buckets. |
maxLoadFactor | Return the maximum load factor allowed for this hash map. |
numStripes | Return the number of stripes in the hash. |
rehash | Recreate this hash map with at least numBuckets buckets. |
setComputedValueAll | Invoke visitor on the value of every element matching key. |
setComputedValueFirst | Invoke visitor on the value of the first element matching key. |
setValueAll | Set the value of every element matching key, or insert one. |
setValueFirst | setValueFirst overloads |
size | Return the current number of elements in this hash map. |
update | Call visitor on each element matching key until it returns false. |
visit | visit overloads |
visitReadOnly | visitReadOnly overloads |