Fixed‐size, lock‐free hash array and building block for AtomicHashMap.
Synopsis
Declared in <folly/AtomicHashArray.h>
template<
class KeyT,
class ValueT,
class HashFcn = std::hash<KeyT>,
class EqualFcn = std::equal_to<KeyT>,
class Allocator = std::allocator<char>,
class ProbeFcn = AtomicHashArrayLinearProbeFcn,
class KeyConvertFcn = Identity>
class AtomicHashArray;
Description
Provides the core lock‐free functionality but cannot grow past its initialization size. Keys must be atomically compare‐and‐swappable integer or pointer types. See AtomicHashMap for the growable container built on top of this one.
Types
Name |
Description |
Named parameters used to configure |
|
Random‐access iterator over the elements of an |
Type Aliases
Name |
Description |
A |
|
A read‐only iterator over the elements of the map. |
|
A const pointer to an element. |
|
A const reference to an element. |
|
A signed integral type used for distances between iterators. |
|
The hash function type used to hash keys. |
|
A mutable iterator over the elements of the map. |
|
The functor type used to convert a lookup key into a stored key. |
|
The equality comparison type used to compare keys. |
|
The type of the keys stored in the map. |
|
The type of the mapped values. |
|
A pointer to an element. |
|
A reference to an element. |
|
An unsigned integral type used for sizes and capacities. |
|
The type of the elements stored in the map. |
Member Functions
Name |
Description |
|
|
Clear all keys and values in the map and reset all counters. |
|
Insert an element, constructing the value in place. |
|
Check whether the map is empty. |
|
|
|
Erase the element with the given key. |
|
Find the element with the given key. |
|
Access an element directly by slot index. |
|
Return the per‐thread cache size for the entry counters. |
|
|
|
|
|
Return the maximum load factor allowed for this map. |
|
Set the per‐thread cache size for the entry counters. |
|
Return the exact number of elements in the map. |
Static Member Functions
Data Members
Name |
Description |
The total number of slots in the underlying array. |
|
The sentinel key value that marks an empty slot. |
|
The sentinel key value that marks an erased slot. |
|
The sentinel key value that marks a slot locked during insertion. |
|
The maximum number of entries allowed before the map is considered full. |
Friends
Name |
Description |
Lock‐free, growable hash map built on top of |
Created with MrDocs