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

#include <tpl_dynSetHash.H>

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

Public Types

using Hash_Fct = std::function< size_t(const Key &)>
 
using Hash_Fct_Ptr = size_t(*)(const Key &)
 
using Value_Type = Data
 
using Iterator = typename Base::Iterator
 
- Public Types inherited from Aleph::DynHashTable< Key, HashTable, Cmp >
using Hash_Fct = typename Base::Hash_Fct
 Hash function type.
 
using Hash_Fct_Ptr = typename Base::Hash_Fct_Ptr
 
using Key_Type = Key
 
using Item_Type = Key
 
- Public Types inherited from StlAlephIterator< SetName >
using iterator = StlIterator< SetName >
 
using const_iterator = StlConstIterator< SetName >
 

Public Member Functions

 DynMapHashTable (size_t len=Primes::DefaultPrime, Hash_Fct_Ptr hash_fct=dft_hash_fct, Cmp cmp=Cmp(), float lower_alpha=hash_default_lower_alpha, float upper_alpha=hash_default_upper_alpha)
 
Pairinsert (const Key &key, const Data &data)
 Inserts into the hash map the pair (key, record) indexed by key.
 
Pairinsert (const Key &key, Data &&data)
 
Pairinsert (Key &&key, Data &&data)
 
Pairinsert (Key &&key, const Data &data)
 
Pairsearch (const Key &key) const noexcept
 Searches for key and, if found, returns a pointer to the associated pair stored in the table.
 
Pairsearch (Key &&key) const noexcept
 
bool has (const Key &key) const noexcept
 Checks if a key exists in the map.
 
bool has (Key &&key) const noexcept
 
bool contains (const Key &key) const noexcept
 Alias for has()
 
bool contains (Key &&key) const noexcept
 
Datafind (const Key &key)
 Finds and returns a reference to the value associated with key.
 
const Datafind (const Key &key) const
 
Dataoperator[] (const Key &key)
 Subscript operator for map access/insertion.
 
const Dataoperator[] (const Key &key) const
 
Dataoperator[] (Key &&key)
 
const Dataoperator[] (Key &&key) const
 
void remove_by_data (Data &data)
 Removes from the table the key whose pointer must be the result of a prior insertion or search.
 
Data remove (const Key &key)
 Removes a key-value pair from the map and returns the value.
 
Data remove (Key &&key)
 
DynList< Key > keys () const
 
DynList< Key > values () const
 
DynList< Data * > values_ptr ()
 
DynList< Pair * > items_ptr ()
 
Key * insert (const Key &key)
 Inserts key into the hash set.
 
Key * insert (Key &&key)
 
- Public Member Functions inherited from Aleph::DynHashTable< Key, HashTable, Cmp >
 DynHashTable (size_t len=Primes::DefaultPrime, Hash_Fct_Ptr hash_fct=Aleph::dft_hash_fct< Key >, Cmp cmp=Cmp(), float lower_alpha=hash_default_lower_alpha, float upper_alpha=hash_default_upper_alpha)
 Creates a dynamic linear hash table.
 
 DynHashTable (size_t len, Hash_Fct hash_fct, Cmp cmp, float lower_alpha, float upper_alpha)
 
 DynHashTable (const DynHashTable &other)
 Copy constructor.
 
 DynHashTable (DynHashTable &&other) noexcept
 
template<template< typename > class List>
 DynHashTable (const List< Key > &l)
 
template<class It >
 DynHashTable (It b, It e)
 
 DynHashTable (std::initializer_list< Key > l)
 
 ~DynHashTable ()
 
DynHashTableoperator= (const DynHashTable &other)
 
DynHashTableoperator= (DynHashTable &&other) noexcept
 
Key * insert (const Key &key)
 Inserts key into the hash set.
 
Key * insert (Key &&key)
 
Key * search_or_insert (const Key &key)
 
Key * search_or_insert (Key &&key)
 
std::pair< Key *, boolcontains_or_insert (const Key &key)
 
std::pair< Key *, boolcontains_or_insert (Key &&key)
 
Key * add (const Key &key)
 
Key * add (Key &&key)
 
Key * append (const Key &key)
 
Key * append (Key &&key)
 
Key * search (const Key &key) const noexcept
 Searches for a key in the hash table.
 
bool has (const Key &key) const noexcept
 Checks if a key exists in the hash table.
 
bool contains (const Key &key) const noexcept
 Alias for has()
 
const Key & find (const Key &key) const
 
Key & find (const Key &key)
 
void remove (Key *key)
 Removes a key from the hash table using its pointer.
 
Key remove (const Key &key)
 
const Key & get_first () const
 
Key & get_first ()
 
const Key & get_last () const
 
Key & get_last ()
 
- Public Member Functions inherited from GenericTraverse< Container >
template<class Operation >
bool traverse (Operation &operation) noexcept(traverse_is_noexcept< Operation >())
 Traverse the container via its iterator and performs a conditioned operation on each item.
 
template<class Operation >
bool traverse (Operation &operation) const noexcept(traverse_is_noexcept< Operation >())
 Const overload of traverse(Operation&).
 
template<class Operation >
bool traverse (Operation &&operation) const noexcept(traverse_is_noexcept< Operation >())
 Overload of traverse(Operation&) const that accepts rvalues.
 
template<class Operation >
bool traverse (Operation &&operation) noexcept(traverse_is_noexcept< Operation >())
 Overload of traverse(Operation&) that accepts rvalues.
 
- Public Member Functions inherited from LocateFunctions< Container, Type >
auto get_it () const
 Return a properly initialized iterator positioned at the first item on the container.
 
auto get_it (const size_t pos) const
 Return a properly initialized iterator positioned at the pos item on the container.
 
auto get_itor () const
 Alias of get_it().
 
Type & nth_ne (const size_t n) noexcept
 Return the n‑th element without bounds checking.
 
const Type & nth_ne (const size_t n) const noexcept
 Const overload of nth_ne(size_t).
 
Type & nth (const size_t n)
 Return the n-th item of container.
 
const Type & nth (const size_t n) const
 Const overload of nth(size_t).
 
template<class Operation >
Type * find_ptr (Operation &operation) noexcept(operation_is_noexcept< Operation >())
 Find a pointer to an item in the container according to a searching criteria.
 
template<class Operation >
const Type * find_ptr (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 Const overload of find_ptr(Operation&).
 
template<class Operation >
const Type * find_ptr (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_ptr(Operation&) const that accepts rvalues.
 
template<class Operation >
Type * find_ptr (Operation &&operation) noexcept(operation_is_noexcept< Operation >())
 Overload of find_ptr(Operation&) that accepts rvalues.
 
template<class Operation >
size_t find_index (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 Find the position of an item in the container according to a searching criteria.
 
template<class Operation >
size_t find_index (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_index(Operation&) that accepts rvalues.
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &operation) noexcept(operation_is_noexcept< Operation >())
 Safe sequential searching of an item matching a criteria.
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &&operation) noexcept(operation_is_noexcept< Operation >())
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 
- Public Member Functions inherited from FunctionalMethods< Container, T >
template<typename ... Args>
void emplace (Args &&... args)
 Appends a new element into the container by constructing it in-place with the given args.
 
template<typename ... Args>
void emplace_end (Args &&... args)
 
template<typename ... Args>
void emplace_ins (Args &&... args)
 Insert a new element into the container by constructing it in-place with the given args.
 
template<typename ... Args>
size_t ninsert (Args ... args)
 Insert n variadic items.
 
template<typename ... Args>
size_t nappend (Args ... args)
 Append n variadic items.
 
template<class Operation >
void for_each (Operation &operation)
 Traverse all the container and performs an operation on each element.
 
template<class Operation >
void for_each (Operation &operation) const
 Const overload of for_each(Operation&).
 
template<class Operation >
void for_each (Operation &&operation) const
 Overload of for_each(Operation&) const that accepts rvalues.
 
template<class Operation >
void for_each (Operation &&operation)
 Overload of for_each(Operation&) that accepts rvalues.
 
template<class Operation >
void each (Operation &operation)
 Alias of for_each(Operation&).
 
template<class Operation >
void each (Operation &operation) const
 Const alias of for_each(Operation&).
 
template<class Operation >
void each (Operation &&operation) const
 Const alias of for_each(Operation&) that accepts rvalues.
 
template<class Operation >
void each (Operation &&operation)
 Alias of for_each(Operation&) that accepts rvalues.
 
template<class Operation >
void each (size_t pos, const size_t slice, Operation &operation) const
 Traverse the container starting at pos taking one item every slice, performing a mutable operation on each visited element.
 
template<class Operation >
void each (const size_t pos, const size_t slice, Operation &&operation) const
 
template<class Operation >
void mutable_for_each (Operation &operation)
 
template<class Operation >
void mutable_for_each (Operation &&operation)
 
template<class Operation >
bool all (Operation &operation) const
 Check if all the elements of container satisfy a condition.
 
template<class Operation >
bool all (Operation &&operation) const
 Overload of all(Operation&) that accepts rvalues.
 
template<class Operation >
bool exists (Operation &op) const
 Test for existence in the container of an element satisfying a criteria.
 
template<class Operation >
bool exists (Operation &&op) const
 Overload of exists(Operation&) that accepts rvalues.
 
template<typename __T = T, class Operation = Aleph::Dft_Map_Op<T, __T>>
Aleph::DynList< __T > maps (Operation &op) const
 Map the elements of the container.
 
template<typename __T = T, class Operation = Aleph::Dft_Map_Op<__T, __T>>
Aleph::DynList< __T > maps (Operation &&op) const
 Overload of maps(Operation&) that accepts rvalues.
 
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __Tmaps_if (Prop prop, Operation &op) const
 Conditional mapping of the elements of the container.
 
template<typename __T = T, class Prop , class Operation >
Aleph::DynList< __Tmaps_if (Prop prop, Operation &&op) const
 Overload of maps_if(Prop, Operation&) that accepts rvalues.
 
Aleph::DynList< T > to_dynlist () const
 Convert container to DynList.
 
std::vector< T > to_vector () const
 Convert container to std::vector.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T foldl (const __T &init, Op &op) const
 Fold the elements of the container to a specific result.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T foldl (const __T &init, Op &&op=Op()) const
 Overload of foldl(const __T&, Op&) that accepts rvalues.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T fold_left (const __T &init, Op &op) const
 Alias for foldl with the same accumulator type.
 
template<typename __T = T, class Op = Aleph::Dft_Fold_Op<__T, T>>
__T fold_left (const __T &init, Op &&op=Op()) const
 Overload of fold_left(const __T&, Op&) that accepts rvalues.
 
template<class Operation >
fold (const T &init, Operation &operation) const
 Simplified version of foldl() where the folded type is the same type of elements stored in the container.
 
template<class Operation >
fold (const T &init, Operation &&operation) const
 Overload of fold(const T&, Operation&) that accepts rvalues.
 
template<class Operation >
Aleph::DynList< T > filter (Operation &operation) const
 Filter the elements of a container according to a matching criteria.
 
template<class Operation >
Aleph::DynList< T > filter (Operation &&operation) const
 Overload of filter(Operation&) that accepts rvalues.
 
template<class Operation >
Aleph::DynList< const T * > ptr_filter (Operation &operation) const
 Filter the elements of a container according to a matching criteria and return a pointer to the matched items in the container.
 
template<class Operation >
Aleph::DynList< const T * > ptr_filter (Operation &&operation) const
 Overload of ptr_filter(Operation&) that accepts rvalues.
 
template<class Operation >
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &operation) const
 Filter the elements of a container according to a matching criteria and determine its positions respect to the traversal of container.
 
template<class Operation >
Aleph::DynList< std::tuple< T, size_t > > pfilter (Operation &&operation) const
 Overload of pfilter(Operation&) that accepts rvalues.
 
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &op) const
 Exclusive partition of container according to a filter criteria.
 
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (Operation &&op) const
 Overload of partition(Operation&) that accepts rvalues.
 
template<class Operation >
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > partition (size_t n) const
 Exclusive partition of container in the nth item.
 
std::pair< Aleph::DynList< T >, Aleph::DynList< T > > split_half () const
 Split the container into two halves by alternating elements.
 
template<class Operation >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &op) const
 Exclusive partition of container according to a filter criteria.
 
template<class Operation >
std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > tpartition (Operation &&op) const
 Overload of tpartition(Operation&) that accepts rvalues.
 
size_t length () const noexcept
 Count the number of elements of a container.
 
Aleph::DynList< T > rev () const
 Return a list with the elements of container in reverse order respect to its traversal order.
 
Aleph::DynList< T > take (const size_t n) const
 Return a list with the first n elements seen in the container during its traversal.
 
Aleph::DynList< T > take (size_t i, const size_t j, const size_t step=1) const
 Return a list with elements seen in the container between i and j position respect to its traversal.
 
Aleph::DynList< T > drop (const size_t n) const
 Drop the first n elements seen in the container during its traversal.
 
void mutable_drop (const size_t n)
 Drop the first n elements seen from container.
 
- Public Member Functions inherited from GenericItems< Container, T >
Aleph::DynList< T > items () const
 Return a list of all the elements of a container sorted by traversal order.
 
Aleph::DynList< T > keys () const
 
- Public Member Functions inherited from EqualToMethod< Container >
bool equal_to (const Container &r) const noexcept
 Test if elements of this are exactly contained in another container.
 
bool operator== (const Container &r) const noexcept
 
bool operator!= (const Container &r) const noexcept
 Negation of equal_to()
 
- Public Member Functions inherited from StlAlephIterator< SetName >
iterator begin () noexcept
 Return an STL-compatible iterator to the first element.
 
iterator end () noexcept
 Return an STL-compatible end iterator.
 
const_iterator begin () const noexcept
 Return a const iterator to the first element.
 
const_iterator end () const noexcept
 Return a const end iterator.
 
const_iterator cbegin () const noexcept
 Return a const iterator to the first element.
 
const_iterator cend () const noexcept
 Return a const end iterator.
 

Static Public Member Functions

static Dataget_data (const Key &key)
 
static const Key & get_key (Data *data_ptr)
 

Private Types

using Pair = std::pair< Key, Data >
 
using Base = DynHashTable< std::pair< Key, Data >, HashTable, Dft_Pair_Cmp< Key, Data, Cmp > >
 
using Bucket = typename Base::Bucket
 

Private Attributes

Hash_Fct_Ptr original_hash_fct
 

Static Private Attributes

static constexpr bool has_search_with_custom_hash
 

Additional Inherited Members

- Protected Types inherited from Aleph::DynHashTable< Key, HashTable, Cmp >
using Base = HashTable< Key, Cmp >
 
using Bucket = typename HashTable< Key, Cmp >::Bucket
 
- Protected Member Functions inherited from Aleph::DynHashTable< Key, HashTable, Cmp >
Key * insert_bucket (Bucket *bucket)
 
std::pair< Key *, boolsearch_or_insert_bucket (Bucket *bucket)
 
- Static Protected Member Functions inherited from Aleph::DynHashTable< Key, HashTable, Cmp >
static Bucketkey_to_bucket (Key *key)
 

Detailed Description

template<typename Key, typename Data, template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
class Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >

Definition at line 458 of file tpl_dynSetHash.H.

Member Typedef Documentation

◆ Base

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
using Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::Base = DynHashTable<std::pair<Key, Data>, HashTable, Dft_Pair_Cmp<Key, Data, Cmp> >
private

Definition at line 464 of file tpl_dynSetHash.H.

◆ Bucket

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
using Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::Bucket = typename Base::Bucket
private

Definition at line 467 of file tpl_dynSetHash.H.

◆ Hash_Fct

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

Definition at line 470 of file tpl_dynSetHash.H.

◆ Hash_Fct_Ptr

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

Definition at line 471 of file tpl_dynSetHash.H.

◆ Iterator

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

Definition at line 499 of file tpl_dynSetHash.H.

◆ Pair

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
using Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::Pair = std::pair<Key, Data>
private

Definition at line 462 of file tpl_dynSetHash.H.

◆ Value_Type

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

Definition at line 495 of file tpl_dynSetHash.H.

Constructor & Destructor Documentation

◆ DynMapHashTable()

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::DynMapHashTable ( size_t  len = Primes::DefaultPrime,
Hash_Fct_Ptr  hash_fct = dft_hash_fct,
Cmp  cmp = Cmp(),
float  lower_alpha = hash_default_lower_alpha,
float  upper_alpha = hash_default_upper_alpha 
)
inline

Definition at line 501 of file tpl_dynSetHash.H.

Member Function Documentation

◆ contains() [1/2]

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

Alias for has()

Definition at line 573 of file tpl_dynSetHash.H.

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

Referenced by TEST(), TEST(), and TEST().

◆ contains() [2/2]

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

◆ find() [1/2]

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

Finds and returns a reference to the value associated with key.

Parameters
[in]keythe key to search for
Returns
reference to the value associated with the key
Exceptions
std::domain_errorif the key is not found
Note
This method does NOT require Data to have a default constructor.

Definition at line 585 of file tpl_dynSetHash.H.

References ah_domain_error_if, and Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::search().

Referenced by Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::operator[](), Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::operator[](), TEST(), TEST(), TEST(), and TEST().

◆ find() [2/2]

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

◆ get_data()

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
static Data & Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::get_data ( const Key &  key)
inlinestatic

Definition at line 485 of file tpl_dynSetHash.H.

References FunctionalMethods< Container, T >::maps().

◆ get_key()

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
static const Key & Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::get_key ( Data data_ptr)
inlinestatic

Definition at line 490 of file tpl_dynSetHash.H.

References FunctionalMethods< Container, T >::maps().

◆ has() [1/2]

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

◆ has() [2/2]

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

◆ insert() [1/6]

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
Key * Aleph::DynHashTable< Key, HashTable, Cmp >::insert ( const Key &  key)
inline

Inserts key into the hash set.

Returns a pointer to the stored key if it was inserted, or nullptr if the key was not inserted.

Definition at line 225 of file tpl_dynSetHash.H.

◆ insert() [2/6]

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

Inserts into the hash map the pair (key, record) indexed by key.

Returns a pointer to the pair stored inside the table. Throws bad_alloc if there is not enough memory.

Definition at line 514 of file tpl_dynSetHash.H.

References Aleph::DynHashTable< Key, HashTable, Cmp >::insert_bucket().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ insert() [3/6]

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

◆ insert() [4/6]

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
Key * Aleph::DynHashTable< Key, HashTable, Cmp >::insert ( Key &&  key)
inline

Definition at line 230 of file tpl_dynSetHash.H.

◆ insert() [5/6]

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

◆ insert() [6/6]

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

◆ items_ptr()

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

Definition at line 679 of file tpl_dynSetHash.H.

References Aleph::DynList< T >::append(), and FunctionalMethods< Container, T >::maps().

Referenced by TEST().

◆ keys()

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

Definition at line 661 of file tpl_dynSetHash.H.

References FunctionalMethods< Container, T >::maps().

Referenced by TEST().

◆ operator[]() [1/4]

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

Subscript operator for map access/insertion.

Note
This method REQUIRES Data to have a default constructor because it needs to insert a new element if the key doesn't exist. If Data is not default-constructible, use find() or search() instead.

Definition at line 605 of file tpl_dynSetHash.H.

References FunctionalMethods< Container, T >::maps(), and Aleph::DynHashTable< Key, HashTable, Cmp >::search_or_insert().

◆ operator[]() [2/4]

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

◆ operator[]() [3/4]

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

◆ operator[]() [4/4]

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

◆ remove() [1/2]

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

Removes a key-value pair from the map and returns the value.

Parameters
[in]keythe key to remove
Returns
the value associated with the removed key
Exceptions
std::domain_errorif the key is not found
Note
Uses move semantics to return the value efficiently. If Data's move constructor is noexcept, this method provides strong exception safety.
This method does NOT require Data to have a default constructor. It uses heterogeneous search to find the key.

Definition at line 644 of file tpl_dynSetHash.H.

References ah_domain_error_if, Aleph::DynHashTable< Key, HashTable, Cmp >::key_to_bucket(), FunctionalMethods< Container, T >::maps(), Aleph::DynHashTable< Key, HashTable, Cmp >::remove(), and Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::search().

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

◆ remove() [2/2]

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

◆ remove_by_data()

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

Removes from the table the key whose pointer must be the result of a prior insertion or search.

Definition at line 627 of file tpl_dynSetHash.H.

References FunctionalMethods< Container, T >::maps(), and Aleph::DynHashTable< Key, HashTable, Cmp >::remove().

◆ search() [1/2]

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

◆ search() [2/2]

◆ values()

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

Definition at line 666 of file tpl_dynSetHash.H.

References FunctionalMethods< Container, T >::maps().

◆ values_ptr()

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

Definition at line 671 of file tpl_dynSetHash.H.

References Aleph::DynList< T >::append(), and FunctionalMethods< Container, T >::maps().

Referenced by TEST().

Member Data Documentation

◆ has_search_with_custom_hash

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
constexpr bool Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::has_search_with_custom_hash
staticconstexprprivate
Initial value:
=
requires(const DynMapHashTable *self, Hash_Fct_Ptr hf, const Key & k)
{
self->search_with_custom_hash(hf, k);
}
DynMapHashTable(size_t len=Primes::DefaultPrime, Hash_Fct_Ptr hash_fct=dft_hash_fct, Cmp cmp=Cmp(), float lower_alpha=hash_default_lower_alpha, float upper_alpha=hash_default_upper_alpha)
size_t(*)(const Key &) Hash_Fct_Ptr
Aleph::DynList< __T > maps(Operation &op) const
Map the elements of the container.
Definition ah-dry.H:904

Definition at line 478 of file tpl_dynSetHash.H.

Referenced by Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::search(), and Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::search().

◆ original_hash_fct

template<typename Key , typename Data , template< class, class > class HashTable = LhashTable, class Cmp = Aleph::equal_to<Key>>
Hash_Fct_Ptr Aleph::DynMapHashTable< Key, Data, HashTable, Cmp >::original_hash_fct
private

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