Inherits .
|
|
| Dictionary () |
| | Constructs an empty Dictionary.
|
| void | add (const t_key &key) |
| | Inserts a key with a default-constructed value if the key does not already exist.
|
| void | add (const t_key &key, const t_value &value) |
| | Inserts a key-value pair if the key does not already exist.
|
| template<class t_key_type> |
| void | add (const t_key_type &key, const t_value &value) |
| | Inserts a key-value pair using a convertible key type, if the key does not already exist.
|
| void | add (t_key &&key) |
| | Inserts a key with a default-constructed value using move semantics, if the key does not already exist.
|
| decltype(auto) | first () const |
| | Retrieves an iterator to the first entry in the dictionary.
|
| template<class t_key_type> |
| t_value & | get (const t_key_type &key) |
| | Retrieves a mutable reference to the value associated with the given key.
|
| template<class t_key_type> |
| const t_value & | get (const t_key_type &key) const |
| | Retrieves a const reference to the value associated with the given key.
|
| decltype(auto) | getFromIndex (uint04 index) const |
| | Retrieves an iterator to the entry at the given iteration index.
|
| template<class t_key_type> |
| bool | hasKey (const t_key_type &key) const |
| | Checks whether the dictionary contains the given key.
|
| uint04 | indexOf (const t_key &key) const |
| | Finds the iteration index of the given key within the dictionary.
|
| template<class t_index_type = uint04, class t_memory_manager = BufferAllocator<t_key, DetermineAlignment<sizeof(t_key)>(), ObjectInfo<t_key>::Primitive, t_index_type, false>> |
| Buffer< t_key, t_memory_manager > | keys () const |
| | Collects all keys in the dictionary into a Buffer.
|
| template<class t_key_type> |
| t_value & | operator[] (const t_key_type &key) |
| | Subscript operator that retrieves or inserts the value associated with the given key.
|
| template<class t_key_type> |
| const t_value & | operator[] (const t_key_type &key) const |
| | Const subscript operator that retrieves the value associated with the given key.
|
| void | removeIndex (uint04 index) |
| | Removes the entry at the given iteration index.
|
| template<class t_key_type> |
| void | set (const t_key_type &key, const t_value &value) |
| | Sets the value for an existing key, replacing the previous value.
|
| uint04 | size () const |
| | Returns the number of entries in the dictionary.
|
| template<class t_index_type = uint04, class t_memory_manager = BufferAllocator<t_value, DetermineAlignment<sizeof(t_value)>(), ObjectInfo<t_value>::Primitive, t_index_type, false>> |
| Buffer< t_value, t_memory_manager > | values () const |
| | Collects all values in the dictionary into a Buffer.
|
template<class t_key, class t_value, class t_hash = std::hash<t_key>>
class Dictionary< t_key, t_value, t_hash >
A hash-based key-value store, useful for quick associative lookups.
Key features include:
- Uses tsl robin library as backing logic and hashmap. Proven to be significantly faster in almost all metrics over std::unordered_set on modern architecture
- Easy functions for converting to other NDEVR containers
- See also
- Buffer, Set
Definition at line 63 of file Dictionary.h.
template<class t_key, class t_value, class t_hash = std::hash<t_key>>
template<class t_key_type>
| bool Dictionary< t_key, t_value, t_hash >::hasKey |
( |
const t_key_type & | key | ) |
const |
|
inlinenodiscard |
template<class t_key, class t_value, class t_hash = std::hash<t_key>>
template<class t_index_type = uint04, class t_memory_manager = BufferAllocator<t_key, DetermineAlignment<sizeof(t_key)>(), ObjectInfo<t_key>::Primitive, t_index_type, false>>
| Buffer< t_key, t_memory_manager > Dictionary< t_key, t_value, t_hash >::keys |
( |
| ) |
const |
|
inlinenodiscard |
template<class t_key, class t_value, class t_hash = std::hash<t_key>>
template<class t_index_type = uint04, class t_memory_manager = BufferAllocator<t_value, DetermineAlignment<sizeof(t_value)>(), ObjectInfo<t_value>::Primitive, t_index_type, false>>
| Buffer< t_value, t_memory_manager > Dictionary< t_key, t_value, t_hash >::values |
( |
| ) |
const |
|
inlinenodiscard |