|
|
| cuckoohash_map (size_type n=LIBCUCKOO_DEFAULT_SIZE, const Hash &hf=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator()) |
|
template<typename InputIt > |
| cuckoohash_map (InputIt first, InputIt last, size_type n=LIBCUCKOO_DEFAULT_SIZE, const Hash &hf=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator()) |
|
| cuckoohash_map (const cuckoohash_map &other) |
|
| cuckoohash_map (const cuckoohash_map &other, const Allocator &alloc) |
|
| cuckoohash_map (cuckoohash_map &&other) noexcept |
|
| cuckoohash_map (cuckoohash_map &&other, const Allocator &alloc) |
|
| cuckoohash_map (std::initializer_list< value_type > init, size_type n=LIBCUCKOO_DEFAULT_SIZE, const Hash &hf=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator()) |
|
void | swap (cuckoohash_map &other) noexcept |
|
cuckoohash_map & | operator= (const cuckoohash_map &other) |
|
cuckoohash_map & | operator= (cuckoohash_map &&other) noexcept |
|
cuckoohash_map & | operator= (std::initializer_list< value_type > ilist) |
|
|
Methods for getting information about the table. Methods that query changing properties of the table are not synchronized with concurrent operations, and may return out-of-date information if the table is being concurrently modified. They will also continue to work after the container has been moved.
|
hasher | hash_function () const |
|
key_equal | key_eq () const |
|
allocator_type | get_allocator () const |
|
size_type | hashpower () const |
|
size_type | bucket_count () const |
|
bool | empty () const |
|
size_type | size () const |
|
size_type | capacity () const |
|
double | load_factor () const |
|
void | minimum_load_factor (const double mlf) |
|
double | minimum_load_factor () const |
|
void | maximum_hashpower (size_type mhp) |
|
size_type | maximum_hashpower () const |
|
void | max_num_worker_threads (size_type extra_threads) |
|
size_type | max_num_worker_threads () const |
|
|
These are operations that affect the data in the table. They are safe to call concurrently with each other.
|
template<typename K , typename F > |
bool | find_fn (const K &key, F fn) const |
|
template<typename K , typename F > |
bool | update_fn (const K &key, F fn) |
|
template<typename K , typename F > |
bool | erase_fn (const K &key, F fn) |
|
template<typename K , typename F , typename... Args> |
bool | uprase_fn (K &&key, F fn, Args &&... val) |
|
template<typename K , typename F , typename... Args> |
bool | upsert (K &&key, F fn, Args &&... val) |
|
template<typename K > |
bool | find (const K &key, mapped_type &val) const |
|
template<typename K > |
mapped_type | find (const K &key) const |
|
template<typename K > |
bool | contains (const K &key) const |
|
template<typename K , typename V > |
bool | update (const K &key, V &&val) |
|
template<typename K , typename... Args> |
bool | insert (K &&key, Args &&... val) |
|
template<typename K , typename V > |
bool | insert_or_assign (K &&key, V &&val) |
|
template<typename K > |
bool | erase (const K &key) |
|
bool | rehash (size_type n) |
|
bool | reserve (size_type n) |
|
void | clear () |
|
locked_table | lock_table () |
|
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
This type is defined as an std::pair
. Note that table behavior is undefined if a user-defined specialization of std::pair<Key, T>
or std::pair<const Key, T>
exists.
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Creates a new cuckohash_map instance
- Parameters
-
n | the number of elements to reserve space for initially |
hf | hash function instance to use |
equal | equality function instance to use |
alloc | allocator instance to use |
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::bucket_count(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::get_allocator().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename InputIt >
cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::cuckoohash_map |
( |
InputIt |
first, |
|
|
InputIt |
last, |
|
|
size_type |
n = LIBCUCKOO_DEFAULT_SIZE , |
|
|
const Hash & |
hf = Hash() , |
|
|
const KeyEqual & |
equal = KeyEqual() , |
|
|
const Allocator & |
alloc = Allocator() |
|
) |
| |
|
inline |
Constructs the map with the contents of the range
[first, last]. If multiple elements in the range have equivalent keys, it is unspecified which element is inserted.
- Parameters
-
first | the beginning of the range to copy from |
last | the end of the range to copy from |
n | the number of elements to reserve space for initially |
hf | hash function instance to use |
equal | equality function instance to use |
alloc | allocator instance to use |
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::insert().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::cuckoohash_map |
( |
const cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET > & |
other | ) |
|
|
inline |
Copy constructor. If other
is being modified concurrently, behavior is unspecified.
- Parameters
-
other | the map being copied |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::cuckoohash_map |
( |
const cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET > & |
other, |
|
|
const Allocator & |
alloc |
|
) |
| |
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::cuckoohash_map |
( |
cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET > && |
other | ) |
|
|
inlinenoexcept |
Move constructor. If other
is being modified concurrently, behavior is unspecified.
- Parameters
-
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::cuckoohash_map |
( |
cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET > && |
other, |
|
|
const Allocator & |
alloc |
|
) |
| |
|
inline |
Move constructor with separate allocator. If the map being moved is being modified concurrently, behavior is unspecified.
- Parameters
-
other | the map being moved |
alloc | the allocator instance to use with the map |
References backward::details::move().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Constructs the map with the contents of initializer list init
.
- Parameters
-
init | initializer list to initialize the elements of the map with |
n | the number of elements to reserve space for initially |
hf | hash function instance to use |
equal | equality function instance to use |
alloc | allocator instance to use |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Returns the number of buckets in the table.
- Returns
- the bucket count
References libcuckoo_bucket_container< Key, T, Allocator, Partial, SLOT_PER_BUCKET >::size().
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::capacity(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::cuckoohash_map().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Returns the current capacity of the table, that is, bucket_count() × slot_per_bucket().
- Returns
- capacity of table
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::bucket_count(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::slot_per_bucket().
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::load_factor().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
void cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::clear |
( |
| ) |
|
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K >
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::contains |
( |
const K & |
key | ) |
const |
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::empty |
( |
| ) |
const |
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K >
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::erase |
( |
const K & |
key | ) |
|
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K , typename F >
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::erase_fn |
( |
const K & |
key, |
|
|
F |
fn |
|
) |
| |
|
inline |
Searches for key
in the table, and invokes fn
on the value if the key is found. The functor can mutate the value, and should return true
in order to erase the element, and false
otherwise.
- Template Parameters
-
K | type of the key |
F | type of the functor. It should implement the method bool operator()(mapped_type&) . |
- Parameters
-
key | the key to possibly erase from the table |
fn | the functor to invoke if the element is found |
- Returns
- true if
key
was found and fn
invoked, false otherwise
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::erase().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K >
Searches the table for key
, and returns the associated value it finds. mapped_type
must be CopyConstructible
.
- Template Parameters
-
- Parameters
-
- Returns
- the value associated with the given key
- Exceptions
-
std::out_of_range | if the key is not found |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K >
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K , typename F >
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::find_fn |
( |
const K & |
key, |
|
|
F |
fn |
|
) |
| const |
|
inline |
Searches the table for key
, and invokes fn
on the value. fn
is not allowed to modify the contents of the value if found.
- Template Parameters
-
K | type of the key. This can be any type comparable with key_type |
F | type of the functor. It should implement the method void operator()(const mapped_type&) . |
- Parameters
-
key | the key to search for |
fn | the functor to invoke if the element is found |
- Returns
- true if the key was found and functor invoked, false otherwise
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::contains(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::find().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
hasher cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::hash_function |
( |
| ) |
const |
|
inline |
Returns the function that hashes the keys
- Returns
- the hash function
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Returns the hashpower of the table, which is log2(bucket_count()).
- Returns
- the hashpower
References libcuckoo_bucket_container< Key, T, Allocator, Partial, SLOT_PER_BUCKET >::hashpower().
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::maximum_hashpower().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K , typename... Args>
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::insert |
( |
K && |
key, |
|
|
Args &&... |
val |
|
) |
| |
|
inline |
Inserts the key-value pair into the table. Equivalent to calling upsert with a functor that does nothing.
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::upsert().
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::cuckoohash_map(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::operator=().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K , typename V >
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::insert_or_assign |
( |
K && |
key, |
|
|
V && |
val |
|
) |
| |
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Returns the function that compares keys for equality
- Returns
- the key comparison function
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
double cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::load_factor |
( |
| ) |
const |
|
inline |
Returns the percentage the table is filled, that is, size() ÷ capacity().
- Returns
- load factor of the table
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::capacity(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::size().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Returns the maximum number of extra worker threads.
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
void cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::max_num_worker_threads |
( |
size_type |
extra_threads | ) |
|
|
inline |
Set the maximum number of extra worker threads the table can spawn when doing large batch operations. Currently batch operations occur in the following scenarios.
- Any resizing operation which invokes cuckoo_expand_simple. This includes any explicit rehash/resize operation, or any general resize if the data is not nothrow-move-constructible.
- Creating a locked_table or resizing within a locked_table.
- Parameters
-
num_threads | the number of extra threads |
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::operator=().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Returns the maximum hashpower of the table
- Returns
- the maximum hashpower
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Sets the maximum hashpower the table can be. If set to LIBCUCKOO_NO_MAXIMUM_HASHPOWER, there will be no limit on the hashpower. Otherwise, the table will not be able to expand beyond the given hashpower, either by an explicit or an automatic expansion.
- Parameters
-
mhp | the hashpower to set the maximum to |
- Exceptions
-
std::invalid_argument | if the current hashpower exceeds the limit |
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::hashpower().
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::operator=().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
double cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::minimum_load_factor |
( |
| ) |
const |
|
inline |
Returns the minimum load factor of the table
- Returns
- the minimum load factor
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
void cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::minimum_load_factor |
( |
const double |
mlf | ) |
|
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
cuckoohash_map& cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::operator= |
( |
const cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET > & |
other | ) |
|
|
inline |
Copy assignment operator. If other
is being modified concurrently, behavior is unspecified.
- Parameters
-
other | the map to assign from |
- Returns
*this
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::max_num_worker_threads(), cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::maximum_hashpower(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::minimum_load_factor().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
cuckoohash_map& cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::operator= |
( |
cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET > && |
other | ) |
|
|
inlinenoexcept |
Move assignment operator. If other
is being modified concurrently, behavior is unspecified.
- Parameters
-
other | the map to assign from |
- Returns
*this
References backward::details::move().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Initializer list assignment operator
- Parameters
-
ilist | an initializer list to assign from |
- Returns
*this
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::clear(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::insert().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Resizes the table to the given hashpower. If this hashpower is not larger than the current hashpower, then it decreases the hashpower to the maximum of the specified value and the smallest hashpower that can hold all the elements currently in the table.
- Parameters
-
n | the hashpower to set for the table |
- Returns
- true if the table changed size, false otherwise
References magic_enum::detail::n().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Reserve enough space in the table for the given number of elements. If the table can already hold that many elements, the function will shrink the table to the smallest hashpower that can hold the maximum of the specified amount and the current table size.
- Parameters
-
n | the number of elements to reserve space for |
- Returns
- true if the size of the table changed, false otherwise
References magic_enum::detail::n().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
Returns the number of elements in the table.
- Returns
- number of elements in the table
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::empty(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::load_factor().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
static constexpr uint16_t cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::slot_per_bucket |
( |
| ) |
|
|
inlinestaticconstexpr |
The number of slots per hash bucket
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::capacity(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::locked_table::slot_per_bucket().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
void cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::swap |
( |
cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET > & |
other | ) |
|
|
inlinenoexcept |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K , typename V >
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::update |
( |
const K & |
key, |
|
|
V && |
val |
|
) |
| |
|
inline |
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K , typename F >
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::update_fn |
( |
const K & |
key, |
|
|
F |
fn |
|
) |
| |
|
inline |
Searches the table for key
, and invokes fn
on the value. fn
is allow to modify the contents of the value if found.
- Template Parameters
-
K | type of the key. This can be any type comparable with key_type |
F | type of the functor. It should implement the method void operator()(mapped_type&) . |
- Parameters
-
key | the key to search for |
fn | the functor to invoke if the element is found |
- Returns
- true if the key was found and functor invoked, false otherwise
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::update().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K , typename F , typename... Args>
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::uprase_fn |
( |
K && |
key, |
|
|
F |
fn, |
|
|
Args &&... |
val |
|
) |
| |
|
inline |
Searches for key
in the table. If the key is found, then fn
is called on the existing value, and nothing happens to the passed-in key and values. The functor can mutate the value, and should return true
in order to erase the element, and false
otherwise. If the key is not found and must be inserted, the pair will be constructed by forwarding the given key and values. If there is no room left in the table, it will be automatically expanded. Expansion may throw exceptions.
- Template Parameters
-
K | type of the key |
F | type of the functor. It should implement the method bool operator()(mapped_type&) . |
Args | list of types for the value constructor arguments |
- Parameters
-
key | the key to insert into the table |
fn | the functor to invoke if the element is found. If your fn needs more data that just the value being modified, consider implementing it as a lambda with captured arguments. |
val | a list of constructor arguments with which to create the value |
- Returns
- true if a new key was inserted, false if the key was already in the table
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::upsert().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
template<typename K , typename F , typename... Args>
bool cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::upsert |
( |
K && |
key, |
|
|
F |
fn, |
|
|
Args &&... |
val |
|
) |
| |
|
inline |
Equivalent to calling uprase_fn with a functor that modifies the given value and always returns false (meaning the element is not removed). The passed-in functor must implement the method void operator()(mapped_type&)
.
References cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::uprase_fn().
Referenced by cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::insert(), and cuckoohash_map< Key, T, Hash, KeyEqual, Allocator, SLOT_PER_BUCKET >::insert_or_assign().
template<class Key , class T , class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, T>>, std::size_t SLOT_PER_BUCKET = LIBCUCKOO_DEFAULT_SLOT_PER_BUCKET>
friend class UnitTestInternalAccess |
|
friend |