Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::MapODhash< Key, Data, Cmp > Struct Template Reference

Open addressing hash map using double hashing. More...

#include <tpl_dynMapOhash.H>

Inheritance diagram for Aleph::MapODhash< Key, Data, Cmp >:
[legend]
Collaboration diagram for Aleph::MapODhash< Key, Data, Cmp >:
[legend]

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.
 
Pairinsert (const Key &key, const Data &data)
 Insert a key-value pair (copy semantics).
 
Pairinsert (const Key &key, Data &&data)
 Insert a key-value pair (move data).
 
Pairinsert (Key &&key, Data &&data)
 Insert a key-value pair (move both).
 
Pairinsert (Key &&key, const Data &data)
 Insert a key-value pair (move key, copy data).
 
Pairsearch (const Key &key) const noexcept
 Search for a key in the map.
 
Pairsearch (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).
 
Datafind (const Key &key)
 Find and return the value for a key.
 
Datafind (Key &&key)
 Find and return the value for a key (move semantics).
 
const Datafind (const Key &key) const
 Find and return the value for a key (const).
 
const Datafind (Key &&key) const
 Find and return the value for a key (const, move).
 
Dataoperator[] (const Key &key)
 Access or insert a value by key.
 
const Dataoperator[] (const Key &key) const
 Access value by key (const version).
 
Dataoperator[] (Key &&key)
 Access or insert a value by key (move semantics).
 
const Dataoperator[] (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< Datavalues () 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 Pairkey_to_pair (Key *ptr) noexcept
 Convert a key pointer to its containing pair pointer.
 
static const Pairkey_to_pair (const Key *ptr) noexcept
 
static Pairdata_to_pair (Data *ptr) noexcept
 Convert a data pointer to its containing pair pointer.
 
static const Pairdata_to_pair (const Data *ptr) noexcept
 
static Dataget_data (Key &key) noexcept
 Get the data associated with a key by reference.
 
static const Dataget_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
 

Detailed Description

template<typename Key, typename Data, class Cmp = Aleph::equal_to<Key>>
struct Aleph::MapODhash< Key, Data, Cmp >

Open addressing hash map using double hashing.

MapODhash is a type alias for MapOpenHash using ODhashTable as the underlying storage. Double hashing provides better distribution and avoids clustering at the cost of slightly more computation.

Template Parameters
KeyType of keys.
DataType of mapped values.
CmpEquality comparator for keys.
See also
MapOpenHash Base template
MapOLhash Linear probing variant

Definition at line 612 of file tpl_dynMapOhash.H.


The documentation for this struct was generated from the following file: