Lock-free unordered map. Uses auto-expanding freelist allocator so memory is only reclaimed upon destruction.
More...
|
| | UnorderedMap (szt capacity=0, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual()) |
| |
| | ~UnorderedMap () |
| |
| void | reserve (szt capacity) |
| | Ensure that enough storage is allocated for a number of elements. More...
|
| |
| szt | capacity () const |
| | The number of elements for which storage is allocated. More...
|
| |
| template<class Pair > |
| bool | insert (Pair &&pair) |
| | Insert new key-value pair into the map. Returns true on success, false if element with key already exists. More...
|
| |
| bool | erase (const Key &key, optional< T & > val=optnull) |
| | Remove element with key from the map and copy its value into val. Returns true on success, false if not found. More...
|
| |
| void | clear () |
| | Remove all elements. More...
|
| |
| bool | find (const Key &key, optional< T & > val=optnull) const |
| | Find element with key and copy its value into val. Returns true on success, false if not found. More...
|
| |
| szt | count (const Key &key) const |
| | Return number of elements with matching key (either 0 or 1) More...
|
| |
| bool | empty () const |
| | Check whether the map does not contain any elements. More...
|
| |
| szt | size () const |
| | The number of elements in the map. More...
|
| |
| szt | bucket_count () const |
| | The number of buckets. A bucket is a slot in the internal hash table to which elements are assigned based on their key hash. More...
|
| |
| float | load_factor () const |
| | The current load factor. The load factor is the ratio between the number of elements and the number of buckets. More...
|
| |
| float | max_load_factor () const |
| | Get the max load factor. The internal hash table will expand when the load factor is above the max load factor. More...
|
| |
| void | max_load_factor (float f) |
| | Set the max load factor. More...
|
| |
template<class Key, class T, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
class honey::lockfree::UnorderedMap< Key, T, Hash, KeyEqual >
Lock-free unordered map. Uses auto-expanding freelist allocator so memory is only reclaimed upon destruction.
Based on the paper: "Split-Ordered Lists - Lock-free Resizable Hash Tables", Shalev, Shavit - 2006