44# ifndef TPL_DYNLHASH_H
45# define TPL_DYNLHASH_H
88 template <
typename Key,
typename Record,
class Cmp = Aleph::equal_to<Key>>
142 <<
"access to unexisting entry";
163 <<
"access to unexisting entry";
304 std::forward<Record>(record)));
317 return bucket !=
nullptr ? &bucket->
record :
nullptr;
Exception handling system with formatted messages for Aleph-w.
#define ah_invalid_argument_if(C)
Throws std::invalid_argument if condition holds.
DLProxy(DynLhashTable &_table, const Key &_key)
DLProxy & operator=(const Record &record)
Dynamic hash table mapping keys to records with separate chaining.
DynLhashTable(const DynLhashTable &table)
Copy constructor.
Record * search(const Key &key)
Search for a key in the table.
DynLhashTable(DynLhashTable &&table) noexcept
Move constructor.
void copy(const DynLhashTable &table)
Record * insert(const Key &key, Record &&record=Record())
This is an overloaded member function, provided for convenience. It differs from the above function o...
DynLhashTable(size_t len=DefaultPrime, Hash_Fct_Ptr hash_fct=dft_hash_fct< Key >)
Construct a dynamic hash table.
void remove(Record *record)
Remove an entry from the table.
Record * insert(Key &&key, const Record &record)
This is an overloaded member function, provided for convenience. It differs from the above function o...
DynLhashTable & operator=(const DynLhashTable &table)
Copy assignment operator.
typename DynLhashTable< Key, Record >::Hash_Fct_Ptr Hash_Fct_Ptr
The type of hash function pointer.
Record * insert(Key &&key, Record &&record)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Record * __insert(DLBucket *bucket)
void swap(DynLhashTable &table) noexcept
Swap contents with another table.
DLProxy operator[](const Key &key) const
Access or insert an entry using subscript notation.
Record * insert(const Key &key, const Record &record)
Insert a key-record pair into the table.
static DLBucket * record_to_bucket(Record *rec)
Iterator over a GenLhashTable hash table.
bool has_curr() const noexcept
Returns true if the iterator has a current bucket.
Bucket * remove(Bucket *bucket) noexcept
Removes bucket from the table.
GenLhashTable & operator=(const GenLhashTable &)=delete
Bucket * insert(Bucket *bucket)
Inserts bucket into the table and returns its address if the key is not already in the table; otherwi...
void empty() noexcept
Empties the hash table; frees memory of all buckets.
void swap(GenLhashTable &other) noexcept
Bucket * search(const Key &key) const noexcept
Search in the table for a bucket with key.
const long double offset[]
Offset values indexed by symbol string length (bounded by MAX_OFFSET_INDEX)
Main namespace for Aleph-w library functions.
DynList< T > maps(const C &c, Op op)
Classic map operation.
const unsigned long DefaultPrime
Default prime number used when no specific size is requested.
DLBucket(Key &&key, const Record &_record)
DLBucket(Key &&key, Record &&_record)
DLBucket(const Key &key, Record &&_record)
DLBucket(const Key &key, const Record &_record)
Generic hash table with collision resolution by separate chaining and buckets with virtual destructor...
Linear hashing with dynamic bucket expansion.