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

Open addressing hash map for key-value pairs. More...

#include <tpl_dynMapOhash.H>

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

Public Types

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

 MapOpenHash (size_t len=Primes::DefaultPrime, Hash_Fct_Ptr first_hash_fct=dft_hash_ptr_fct< Key >, Hash_Fct_Ptr second_hash_fct=snd_hash_ptr_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).
 
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

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 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
 

Detailed Description

template<typename Key, typename Data, class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
requires EqualityComparator<Cmp, Key>
struct Aleph::MapOpenHash< Key, Data, Cmp, HashTable >

Open addressing hash map for key-value pairs.

MapOpenHash<Key, Data, Cmp, HashTable> implements an associative container that maps keys to values using open addressing hash tables. It provides O(1) average-case complexity for insert, search, and delete operations.

Features

Example Usage

// Create a map with string keys and int values
// Insert elements
ages.insert("Alice", 30);
ages["Bob"] = 25;
// Search and access
if (ages.has("Alice"))
std::cout << "Alice's age: " << ages["Alice"] << '\n';
// Iterate
ages.traverse([](auto& pair) {
std::cout << pair.first << ": " << pair.second << '\n';
return true;
});
// Remove
ages.remove("Bob");
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
std::pair< First, Second > pair
Alias to std::pair kept for backwards compatibility.
Definition ahPair.H:89
Open addressing hash map using double hashing.
Pair * insert(const Key &key, const Data &data)
Insert a key-value pair (copy semantics).

Hash Table Variants

  • MapODhash: Uses double hashing (better distribution, more complex)
  • MapOLhash: Uses linear probing (simpler, better cache locality)

Thread Safety

This class is not thread-safe. External synchronization is required for concurrent access from multiple threads.

Template Parameters
KeyType of keys. Must be hashable and equality-comparable.
DataType of mapped values.
CmpEquality comparator for keys (default: Aleph::equal_to<Key>).
HashTableUnderlying hash table type (default: ODhashTable).
See also
MapODhash Double hashing variant
MapOLhash Linear probing variant
ODhashTable Underlying double hashing table
OLhashTable Underlying linear probing table

Definition at line 118 of file tpl_dynMapOhash.H.

Member Typedef Documentation

◆ Base

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Base = HashTable<std::pair<Key, Data>, Dft_Pair_Cmp<Key, Data, Cmp> >

The base hash table type.

Definition at line 125 of file tpl_dynMapOhash.H.

◆ Data_Type

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Data_Type = Data

The type of mapped values.

Definition at line 140 of file tpl_dynMapOhash.H.

◆ Hash_Fct

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Hash_Fct = std::function<size_t(const Key &)>

Function type for hash functions.

Definition at line 131 of file tpl_dynMapOhash.H.

◆ Hash_Fct_Ptr

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Hash_Fct_Ptr = size_t (*) (const Key &)

Function pointer type for hash functions.

Definition at line 134 of file tpl_dynMapOhash.H.

◆ Item_Type

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Item_Type = Pair

The item type stored in the map (key-value pair).

Definition at line 146 of file tpl_dynMapOhash.H.

◆ Iterator

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Iterator = typename Base::Iterator

Iterator type for traversing the map.

Definition at line 526 of file tpl_dynMapOhash.H.

◆ Key_Type

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Key_Type = Key

The type of keys in the map.

Definition at line 137 of file tpl_dynMapOhash.H.

◆ Pair

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Pair = std::pair<Key, Data>

The key-value pair type stored in the map.

Definition at line 122 of file tpl_dynMapOhash.H.

◆ Set_Type

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Set_Type = MapOpenHash

Self-reference type for generic programming.

Definition at line 149 of file tpl_dynMapOhash.H.

◆ Value_Type

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
using Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::Value_Type = Data

Alias for Data_Type (compatibility with other containers).

Definition at line 143 of file tpl_dynMapOhash.H.

Constructor & Destructor Documentation

◆ MapOpenHash()

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::MapOpenHash ( size_t  len = Primes::DefaultPrime,
Hash_Fct_Ptr  first_hash_fct = dft_hash_ptr_fct<Key>,
Hash_Fct_Ptr  second_hash_fct = snd_hash_ptr_fct<Key>,
Cmp  cmp = Cmp(),
float  lower_alpha = hash_default_lower_alpha,
float  upper_alpha = hash_default_upper_alpha,
bool  with_resize = true 
)
inline

Construct a map with specified parameters.

Parameters
[in]lenInitial table size (default: DefaultPrime).
[in]first_hash_fctPrimary hash function.
[in]second_hash_fctSecondary hash function (for double hashing).
[in]cmpEquality comparator for keys.
[in]lower_alphaLower load factor threshold for shrinking.
[in]upper_alphaUpper load factor threshold for growing.
[in]with_resizeEnable automatic resizing.
Exceptions
std::bad_allocIf memory allocation fails.

Definition at line 163 of file tpl_dynMapOhash.H.

Member Function Documentation

◆ contains() [1/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
bool Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::contains ( const Key &  key) const
inlinenoexcept

Check if a key exists in the map.

Alias for has().

Parameters
[in]keyThe key to check.
Returns
true if the key exists, false otherwise.

Definition at line 361 of file tpl_dynMapOhash.H.

References Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::has().

◆ contains() [2/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
bool Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::contains ( Key &&  key) const
inlinenoexcept

Check if a key exists in the map (move semantics).

Parameters
[in]keyThe key to check.
Returns
true if the key exists, false otherwise.

Definition at line 371 of file tpl_dynMapOhash.H.

References Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::has().

◆ data_to_pair() [1/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
static const Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::data_to_pair ( const Data *  ptr)
inlinestaticnoexcept

Definition at line 214 of file tpl_dynMapOhash.H.

References Aleph::divide_and_conquer_partition_dp().

◆ data_to_pair() [2/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
static Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::data_to_pair ( Data *  ptr)
inlinestaticnoexcept

Convert a data pointer to its containing pair pointer.

Given a pointer to the data (second) member of a pair, returns a pointer to the enclosing pair.

Parameters
[in]ptrPointer to data within a pair.
Returns
Pointer to the containing pair.
Warning
Only valid for pointers obtained from pairs in this map.

Definition at line 208 of file tpl_dynMapOhash.H.

References Aleph::divide_and_conquer_partition_dp().

Referenced by Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::get_key(), Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::get_key(), and Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::remove_by_data().

◆ find() [1/4]

◆ find() [2/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
const Data & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::find ( const Key &  key) const
inline

Find and return the value for a key (const).

Parameters
[in]keyThe key to find.
Returns
Const reference to the associated value.
Exceptions
std::domain_errorIf the key is not found.

Definition at line 411 of file tpl_dynMapOhash.H.

◆ find() [3/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Data & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::find ( Key &&  key)
inline

Find and return the value for a key (move semantics).

Parameters
[in]keyThe key to find.
Returns
Reference to the associated value.
Exceptions
std::domain_errorIf the key is not found.

Definition at line 397 of file tpl_dynMapOhash.H.

◆ find() [4/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
const Data & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::find ( Key &&  key) const
inline

Find and return the value for a key (const, move).

Parameters
[in]keyThe key to find.
Returns
Const reference to the associated value.
Exceptions
std::domain_errorIf the key is not found.

Definition at line 425 of file tpl_dynMapOhash.H.

◆ get_data() [1/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
static const Data & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::get_data ( const Key &  key)
inlinestaticnoexcept

◆ get_data() [2/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
static Data & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::get_data ( Key &  key)
inlinestaticnoexcept

Get the data associated with a key by reference.

Given a reference to a key that is stored in the map, returns a reference to its associated data.

Parameters
[in]keyReference to a key within a stored pair.
Returns
Reference to the associated data.
Warning
Only valid for keys obtained from pairs in this map.

Definition at line 230 of file tpl_dynMapOhash.H.

References Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::key_to_pair().

◆ get_key() [1/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
static const Key & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::get_key ( const Data *  data_ptr)
inlinestaticnoexcept

◆ get_key() [2/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
static const Key & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::get_key ( Data *  data_ptr)
inlinestaticnoexcept

Get the key associated with a data pointer.

Given a pointer to data stored in the map, returns a reference to its associated key.

Parameters
[in]data_ptrPointer to data within a stored pair.
Returns
Reference to the associated key.
Warning
Only valid for data pointers obtained from this map.

Definition at line 250 of file tpl_dynMapOhash.H.

References Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::data_to_pair().

◆ has() [1/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
bool Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::has ( const Key &  key) const
inlinenoexcept

Check if a key exists in the map.

Parameters
[in]keyThe key to check.
Returns
true if the key exists, false otherwise.

Definition at line 339 of file tpl_dynMapOhash.H.

References Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search().

Referenced by Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::contains(), Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::contains(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ has() [2/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
bool Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::has ( Key &&  key) const
inlinenoexcept

Check if a key exists in the map (move semantics).

Parameters
[in]keyThe key to check.
Returns
true if the key exists, false otherwise.

Definition at line 349 of file tpl_dynMapOhash.H.

References Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search().

◆ insert() [1/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::insert ( const Key &  key,
const Data &  data 
)
inline

Insert a key-value pair (copy semantics).

Inserts a new key-value pair into the map. If the key already exists, no insertion occurs.

Parameters
[in]keyThe key to insert.
[in]dataThe value to associate with the key.
Returns
Pointer to the inserted pair, or nullptr if key exists.
Exceptions
std::bad_allocIf memory allocation fails during resize.

Definition at line 271 of file tpl_dynMapOhash.H.

Referenced by Aleph::Gen_Mo_On_Trees< GT, Policy >::build(), Aleph::Gen_Mo_On_Tree_Node< T, Policy >::build(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::index_nodes(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::index_nodes(), Aleph::tree_decomposition_detail::Rooted_Tree_Topology< GT, SA >::index_nodes(), Aleph::tree_dp_detail::Tree_Topology< GT, SA >::index_nodes(), MapODhashTest::populate_int_map(), MapODhashTest::populate_map(), MapOLhashTest::populate_map(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ insert() [2/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::insert ( const Key &  key,
Data &&  data 
)
inline

Insert a key-value pair (move data).

Parameters
[in]keyThe key to insert.
[in]dataThe value to move into the map.
Returns
Pointer to the inserted pair, or nullptr if key exists.

Definition at line 282 of file tpl_dynMapOhash.H.

◆ insert() [3/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::insert ( Key &&  key,
const Data &  data 
)
inline

Insert a key-value pair (move key, copy data).

Parameters
[in]keyThe key to move into the map.
[in]dataThe value to copy into the map.
Returns
Pointer to the inserted pair, or nullptr if key exists.

Definition at line 305 of file tpl_dynMapOhash.H.

◆ insert() [4/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::insert ( Key &&  key,
Data &&  data 
)
inline

Insert a key-value pair (move both).

Parameters
[in]keyThe key to move into the map.
[in]dataThe value to move into the map.
Returns
Pointer to the inserted pair, or nullptr if key exists.

Definition at line 293 of file tpl_dynMapOhash.H.

◆ items_ptr()

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
DynList< Pair * > Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::items_ptr ( )
inline

Get a list of pointers to all pairs.

Returns
DynList containing pointers to all pairs in the map.
Note
The pointers remain valid until the map is modified.

Definition at line 566 of file tpl_dynMapOhash.H.

References Aleph::DynList< T >::append(), and Aleph::divide_and_conquer_partition_dp().

◆ key_to_pair() [1/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
static const Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::key_to_pair ( const Key *  ptr)
inlinestaticnoexcept

Definition at line 193 of file tpl_dynMapOhash.H.

◆ key_to_pair() [2/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
static Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::key_to_pair ( Key *  ptr)
inlinestaticnoexcept

Convert a key pointer to its containing pair pointer.

Given a pointer to the key member of a pair, returns a pointer to the enclosing pair. This relies on the fact that the key is the first member of std::pair.

Parameters
[in]ptrPointer to a key within a pair.
Returns
Pointer to the containing pair.
Warning
Only valid for pointers obtained from pairs in this map.

Definition at line 188 of file tpl_dynMapOhash.H.

Referenced by Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::get_data(), and Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::get_data().

◆ keys()

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
DynList< Key > Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::keys ( ) const
inline

Get a list of all keys in the map.

Returns
DynList containing copies of all keys.

Definition at line 532 of file tpl_dynMapOhash.H.

References Aleph::divide_and_conquer_partition_dp().

◆ operator[]() [1/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Data & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::operator[] ( const Key &  key)
inline

Access or insert a value by key.

If the key exists, returns a reference to its value. If not, inserts a new pair with default-constructed value and returns a reference to it.

Parameters
[in]keyThe key to access or insert.
Returns
Reference to the value associated with the key.
Exceptions
std::bad_allocIf insertion requires memory allocation.

Definition at line 443 of file tpl_dynMapOhash.H.

◆ operator[]() [2/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
const Data & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::operator[] ( const Key &  key) const
inline

Access value by key (const version).

Parameters
[in]keyThe key to access.
Returns
Const reference to the value.
Exceptions
std::domain_errorIf the key is not found.

Definition at line 457 of file tpl_dynMapOhash.H.

References Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::find().

◆ operator[]() [3/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Data & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::operator[] ( Key &&  key)
inline

Access or insert a value by key (move semantics).

Parameters
[in]keyThe key to access or insert.
Returns
Reference to the value associated with the key.

Definition at line 467 of file tpl_dynMapOhash.H.

◆ operator[]() [4/4]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
const Data & Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::operator[] ( Key &&  key) const
inline

Access value by key (const, move).

Parameters
[in]keyThe key to access.
Returns
Const reference to the value.
Exceptions
std::domain_errorIf the key is not found.

Definition at line 481 of file tpl_dynMapOhash.H.

References Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::find().

◆ remove() [1/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
void Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::remove ( const Key &  key)
inline

Remove an entry by key.

Parameters
[in]keyThe key to remove.
Exceptions
std::domain_errorIf the key is not found.

Definition at line 505 of file tpl_dynMapOhash.H.

Referenced by TEST(), and TEST().

◆ remove() [2/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
void Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::remove ( Key &&  key)
inline

Remove an entry by key (move semantics).

Parameters
[in]keyThe key to remove.
Exceptions
std::domain_errorIf the key is not found.

Definition at line 518 of file tpl_dynMapOhash.H.

◆ remove_by_data()

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
void Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::remove_by_data ( Data &  data)
inline

Remove an entry by its data pointer.

Removes the key-value pair that contains the given data pointer.

Parameters
[in]dataReference to data within a stored pair.
Warning
Only valid for data references obtained from this map.

Definition at line 494 of file tpl_dynMapOhash.H.

References Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::data_to_pair().

◆ search() [1/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search ( const Key &  key) const
inlinenoexcept

◆ search() [2/2]

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
Pair * Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::search ( Key &&  key) const
inlinenoexcept

Search for a key in the map (move semantics).

Parameters
[in]keyThe key to search for.
Returns
Pointer to the pair if found, nullptr otherwise.

Definition at line 327 of file tpl_dynMapOhash.H.

◆ values()

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
DynList< Data > Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::values ( ) const
inline

Get a list of all values in the map.

Returns
DynList containing copies of all values.

Definition at line 541 of file tpl_dynMapOhash.H.

References Aleph::divide_and_conquer_partition_dp().

◆ values_ptr()

template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>, template< typename, class > class HashTable = ODhashTable>
DynList< Data * > Aleph::MapOpenHash< Key, Data, Cmp, HashTable >::values_ptr ( )
inline

Get a list of pointers to all values.

Returns
DynList containing pointers to all values in the map.
Note
The pointers remain valid until the map is modified.

Definition at line 552 of file tpl_dynMapOhash.H.

References Aleph::DynList< T >::append(), and Aleph::divide_and_conquer_partition_dp().


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