|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Open addressing hash map using linear probing. More...
#include <tpl_dynMapOhash.H>
Additional Inherited Members | |
Public Types inherited from Aleph::MapOpenHash< Key, Data, Cmp, HashTable > | |
| using | Pair = std::pair< Key, Data > |
| The key-value pair type stored in the map. | |
| using | Base = HashTable< std::pair< Key, Data >, Dft_Pair_Cmp< Key, Data, Cmp > > |
| The base hash table type. | |
| using | Hash_Fct = std::function< size_t(const Key &)> |
| Function type for hash functions. | |
| using | Hash_Fct_Ptr = size_t(*)(const Key &) |
| Function pointer type for hash functions. | |
| using | Key_Type = Key |
| The type of keys in the map. | |
| using | Data_Type = Data |
| The type of mapped values. | |
| using | Value_Type = Data |
| Alias for Data_Type (compatibility with other containers). | |
| using | Item_Type = Pair |
| The item type stored in the map (key-value pair). | |
| using | Set_Type = MapOpenHash |
| Self-reference type for generic programming. | |
| using | Iterator = typename Base::Iterator |
| Iterator type for traversing the map. | |
Public Member Functions inherited from Aleph::MapOpenHash< Key, Data, Cmp, HashTable > | |
| MapOpenHash (size_t len=Primes::DefaultPrime, Hash_Fct_Ptr first_hash_fct=dft_hash_fct< Key >, Hash_Fct_Ptr second_hash_fct=snd_hash_fct< Key >, Cmp cmp=Cmp(), float lower_alpha=hash_default_lower_alpha, float upper_alpha=hash_default_upper_alpha, bool with_resize=true) | |
| Construct a map with specified parameters. | |
| Pair * | insert (const Key &key, const Data &data) |
| Insert a key-value pair (copy semantics). | |
| Pair * | insert (const Key &key, Data &&data) |
| Insert a key-value pair (move data). | |
| Pair * | insert (Key &&key, Data &&data) |
| Insert a key-value pair (move both). | |
| Pair * | insert (Key &&key, const Data &data) |
| Insert a key-value pair (move key, copy data). | |
| Pair * | search (const Key &key) const noexcept |
| Search for a key in the map. | |
| Pair * | search (Key &&key) const noexcept |
| Search for a key in the map (move semantics). | |
| bool | has (const Key &key) const noexcept |
| Check if a key exists in the map. | |
| bool | has (Key &&key) const noexcept |
| Check if a key exists in the map (move semantics). | |
| bool | contains (const Key &key) const noexcept |
| Check if a key exists in the map. | |
| bool | contains (Key &&key) const noexcept |
| Check if a key exists in the map (move semantics). | |
| Data & | find (const Key &key) |
| Find and return the value for a key. | |
| Data & | find (Key &&key) |
| Find and return the value for a key (move semantics). | |
| const Data & | find (const Key &key) const |
| Find and return the value for a key (const). | |
| const Data & | find (Key &&key) const |
| Find and return the value for a key (const, move). | |
| Data & | operator[] (const Key &key) |
| Access or insert a value by key. | |
| const Data & | operator[] (const Key &key) const |
| Access value by key (const version). | |
| Data & | operator[] (Key &&key) |
| Access or insert a value by key (move semantics). | |
| const Data & | operator[] (Key &&key) const |
| Access value by key (const, move). | |
| void | remove_by_data (Data &data) |
| Remove an entry by its data pointer. | |
| void | remove (const Key &key) |
| Remove an entry by key. | |
| void | remove (Key &&key) |
| Remove an entry by key (move semantics). | |
| DynList< Key > | keys () const |
| Get a list of all keys in the map. | |
| DynList< Data > | values () const |
| Get a list of all values in the map. | |
| DynList< Data * > | values_ptr () |
| Get a list of pointers to all values. | |
| DynList< Pair * > | items_ptr () |
| Get a list of pointers to all pairs. | |
Static Public Member Functions inherited from Aleph::MapOpenHash< Key, Data, Cmp, HashTable > | |
| static Pair * | key_to_pair (Key *ptr) noexcept |
| Convert a key pointer to its containing pair pointer. | |
| static const Pair * | key_to_pair (const Key *ptr) noexcept |
| static Pair * | data_to_pair (Data *ptr) noexcept |
| Convert a data pointer to its containing pair pointer. | |
| static const Pair * | data_to_pair (const Data *ptr) noexcept |
| static Data & | get_data (Key &key) noexcept |
| Get the data associated with a key by reference. | |
| static const Data & | get_data (const Key &key) noexcept |
| static const Key & | get_key (Data *data_ptr) noexcept |
| Get the key associated with a data pointer. | |
| static const Key & | get_key (const Data *data_ptr) noexcept |
Open addressing hash map using linear probing.
MapOLhash is a type alias for MapOpenHash using OLhashTable as the underlying storage. Linear probing offers excellent cache locality but may suffer from clustering with certain hash functions.
| Key | Type of keys. |
| Data | Type of mapped values. |
| Cmp | Equality comparator for keys. |
Definition at line 590 of file tpl_dynMapOhash.H.