Lock‐free, growable hash map built on top of AtomicHashArray.

Synopsis

Declared in <folly/AtomicHashMap.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 AtomicHashMap;

Types

Name

Description

ahm_iterator

Iterator template shared by the mutable and const iterators.

Type Aliases

Name

Description

Config

Configuration options forwarded to the underlying submaps.

const_iterator

Read‐only iterator over the elements of the map.

const_reference

Reference to a const element.

difference_type

Signed integer type for iterator differences.

hasher

The hash function object type.

iterator

Mutable iterator over the elements of the map.

key_convert

The functor type converting a lookup key to a stored key.

key_equal

The key equality comparison type.

key_type

The key type stored in the map.

mapped_type

The mapped value type stored in the map.

pointer

Pointer to an element.

reference

Reference to an element.

size_type

Unsigned integer type for sizes and counts.

value_type

The element type, a key/value pair.

Member Functions

Name

Description

AtomicHashMap [constructor]

Constructors

~AtomicHashMap [destructor]

Destroy the map and all of its allocated submaps.

operator= [deleted]

Deleted copy assignment; the map is not assignable.

begin

begin overloads

capacity

Return the total capacity, the sum of the capacities of all submaps.

clear

Wipe all keys and values from the map.

count

Count the elements with a given key.

emplace

Insert an element, constructing the value in place.

empty

Report whether the map is empty.

end

end overloads

erase

Erase a key from the map.

find

Find the element with the given key.

findAt

findAt overloads

hash_function

Return the hash function object.

idxToRec

Return the element stored at a given index.

insert

insert overloads

keyToIdx

Return the stored index for a key, optionally inserting a default value.

key_eq

Return the key equality comparison object.

numSubMaps

Return the number of submaps allocated so far to implement this map.

recToIdx

recToIdx overloads

setEntryCountThreadCacheSize

Set the thread‐cache size of the entry counter for every submap.

size

Return the exact number of elements in the map.

spaceRemaining

Return the number of insertions before all submaps reach max load factor.

Data Members

Name

Description

kGrowthFrac_

How much to grow when we run out of capacity.

Template Parameters

Name

Description

KeyT

The key type; must be a 32‐bit or 64‐bit atomic integer type.

ValueT

The mapped value type.

HashFcn

The hash function object type.

EqualFcn

The key equality comparison type.

Allocator

The stateless allocator type.

ProbeFcn

The probing strategy type.

KeyConvertFcn

The functor converting a lookup key to a stored key.

Created with MrDocs