[#BloombergLP-bdlcc-StripedUnorderedMap] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlcc.adoc[bdlcc]::StripedUnorderedMap :relfileprefix: ../../ :mrdocs: Fully thread‐safe hash map from `KEY` to `VALUE`, partitioned into stripes. == Synopsis Declared in `<bdlcc_stripedunorderedmap.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY, class VALUE, class HASH = xref:bsl/hash-06.adoc[bsl::hash<KEY>], class EQUAL = xref:bsl/equal_to-0d.adoc[bsl::equal_to<KEY>]> class StripedUnorderedMap; ---- == Description 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_map` object guarded by a single lock. The interface is inspired by, but not identical to that of `bsl::unordered_map`. 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. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlcc/StripedUnorderedMap/EraseIfValuePredicate.adoc[`EraseIfValuePredicate`] | Alias for a predicate that selects values to erase. | xref:BloombergLP/bdlcc/StripedUnorderedMap/KVType.adoc[`KVType`] | Value type of a bulk insert entry. | xref:BloombergLP/bdlcc/StripedUnorderedMap/ReadOnlyVisitorFunction.adoc[`ReadOnlyVisitorFunction`] | Alias for a read‐only visitor over element values. | xref:BloombergLP/bdlcc/StripedUnorderedMap/VisitorFunction.adoc[`VisitorFunction`] | Alias for a visitor that may modify element values. |=== == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlcc/StripedUnorderedMap/_04enum.adoc[`Unnamed enum`] | Default sizing constants for this map. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlcc/StripedUnorderedMap/2constructor-03.adoc[`StripedUnorderedMap`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlcc/StripedUnorderedMap/allocator.adoc[`allocator`] | Return the allocator used by this hash map to supply memory. | xref:BloombergLP/bdlcc/StripedUnorderedMap/bucketCount.adoc[`bucketCount`] | Return the number of buckets maintained by this hash map. | xref:BloombergLP/bdlcc/StripedUnorderedMap/bucketIndex.adoc[`bucketIndex`] | Return the bucket index where elements with `key` are inserted. | xref:BloombergLP/bdlcc/StripedUnorderedMap/bucketSize.adoc[`bucketSize`] | Return the number of elements in the bucket at `index`. | xref:BloombergLP/bdlcc/StripedUnorderedMap/clear.adoc[`clear`] | Remove all elements from this hash map. If rehash is in progress, block until it completes. | xref:BloombergLP/bdlcc/StripedUnorderedMap/disableRehash.adoc[`disableRehash`] | Prevent future rehash until `enableRehash` is called. | xref:BloombergLP/bdlcc/StripedUnorderedMap/empty.adoc[`empty`] | Return `true` if this hash map contains no elements, and `false` otherwise. | xref:BloombergLP/bdlcc/StripedUnorderedMap/enableRehash.adoc[`enableRehash`] | Allow rehashing to resume when the load factor is exceeded. | xref:BloombergLP/bdlcc/StripedUnorderedMap/equalFunction.adoc[`equalFunction`] | Return a copy of the key‐equality functor used by this hash map. | xref:BloombergLP/bdlcc/StripedUnorderedMap/erase.adoc[`erase`] | Erase the element having the specified `key`. | xref:BloombergLP/bdlcc/StripedUnorderedMap/eraseBulk.adoc[`eraseBulk`] | Erase elements whose keys fall in the range `[first, last)]`. | xref:BloombergLP/bdlcc/StripedUnorderedMap/eraseIf.adoc[`eraseIf`] | Remove the element with `key` if `predicate` holds true. | xref:BloombergLP/bdlcc/StripedUnorderedMap/getValue.adoc[`getValue`] | Load into `*value` the value for `key`, if present. | xref:BloombergLP/bdlcc/StripedUnorderedMap/hashFunction.adoc[`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. | xref:BloombergLP/bdlcc/StripedUnorderedMap/insert-08.adoc[`insert`] | `insert` overloads | xref:BloombergLP/bdlcc/StripedUnorderedMap/insertBulk.adoc[`insertBulk`] | Insert or update unique keys from the range `[first, last)]`. | xref:BloombergLP/bdlcc/StripedUnorderedMap/isRehashEnabled.adoc[`isRehashEnabled`] | Return `true` if rehash is enabled, or `false` otherwise. | xref:BloombergLP/bdlcc/StripedUnorderedMap/loadFactor.adoc[`loadFactor`] | Return the current load factor of this hash map. | xref:BloombergLP/bdlcc/StripedUnorderedMap/maxLoadFactor.adoc[`maxLoadFactor`] | Return the maximum load factor allowed for this hash map. | xref:BloombergLP/bdlcc/StripedUnorderedMap/numStripes.adoc[`numStripes`] | Return the number of stripes in the hash. | xref:BloombergLP/bdlcc/StripedUnorderedMap/rehash.adoc[`rehash`] | Recreate this hash map with at least `numBuckets` buckets. | xref:BloombergLP/bdlcc/StripedUnorderedMap/setComputedValue.adoc[`setComputedValue`] | Invoke `visitor` on the value for `key`, inserting a default if absent. | xref:BloombergLP/bdlcc/StripedUnorderedMap/setValue-0f.adoc[`setValue`] | `setValue` overloads | xref:BloombergLP/bdlcc/StripedUnorderedMap/size.adoc[`size`] | Return the current number of elements in this hash map. | xref:BloombergLP/bdlcc/StripedUnorderedMap/update.adoc[`update`] | Call `visitor` on the element having `key`, if present. | xref:BloombergLP/bdlcc/StripedUnorderedMap/visit-0c.adoc[`visit`] | `visit` overloads | xref:BloombergLP/bdlcc/StripedUnorderedMap/visitReadOnly-04.adoc[`visitReadOnly`] | `visitReadOnly` overloads |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#