52# include <initializer_list>
59 template <
typename Key,
60 template <
typename,
class>
class HashSetTable =
OLhashTable,
62 struct HashSet :
public HashSetTable<Key, Cmp>
64 typedef HashSetTable<Key, Cmp>
Base;
80 const Key &
get_first()
const {
return this->get_it().get_curr(); }
84 auto it = this->get_it();
103 bool is_empty() const noexcept {
return this->Base::is_empty(); }
107 <
typename Key,
typename Data,
108 template <
typename,
typename,
class>
class HashMapTable =
MapOLhash,
110 struct HashMap :
public HashMapTable<Key, Data, Cmp>
112 typedef HashMapTable<Key, Data, Cmp>
Base;
116 void add(std::initializer_list<Key> lk, std::initializer_list<Data> ld)
119 <<
"size mismatch between domain and range";
121 auto itk = lk.begin();
122 auto itd = ld.begin();
123 for (; itk != lk.end(); ++itk, ++itd)
124 this->insert(*itk, *itd);
129 HashMap(std::initializer_list<Key> lk, std::initializer_list<Data> ld)
139 <<
"size mismatch between domain and range";
141 auto itd = ld.begin();
142 c.for_each( [
this, &itd](
const Key & key)
144 set_entry(key, *itd++);
157 using Base::contains;
164 bool is_empty() const noexcept {
return this->Base::is_empty(); }
171 template <
typename Key,
172 template <
typename,
class>
class HashSetTable =
OLhashTable,
180 template <
typename Key,
typename Data,
181 template <
typename,
typename,
class>
class HashMapTable =
MapOLhash,
#define Derived_Build(Name)
Declare build() in a class derived from a container.
Exception handling system with formatted messages for Aleph-w.
#define ah_range_error_if(C)
Throws std::range_error if condition holds.
#define Generate_Proxy_Operator(Class_Name)
Generates operator[] for map-like containers.
#define Special_Ctors(Set_Type, Type)
Generates special constructors for containers.
Doubly-linked list (defined in tpl_dynList.H).
Open addressing hash table with linear probing collision resolution.
void for_each(Operation &operation) const
Traverse all the container and performs an operation on each element.
Main namespace for Aleph-w library functions.
HashMapTable< Key, Data, Cmp > Base
void add(std::initializer_list< Key > lk, std::initializer_list< Data > ld)
bool is_empty() const noexcept
Checks if the container is empty.
void clear()
Empties the container.
HashMap(const Container< Key > &c, std::initializer_list< Data > ld)
HashMap(std::initializer_list< Key > lk, std::initializer_list< Data > ld)
void clear()
Empties the container.
void add(const DynList< Key > &l)
const Key & get_last() const
bool is_empty() const noexcept
Checks if the container is empty.
HashSetTable< Key, Cmp > Base
const Key & get_first() const
Open addressing hash map using linear probing.
Dynamic map with open hashing.
Dynamic set implementations based on hash tables.