5 # include <initializer_list>
6 # include <tpl_dynSetHash.H>
7 # include <tpl_dynSetOhash.H>
12 template <
typename Key,
13 template <
typename,
class>
class HashSetTable =
ODhashTable,
15 struct HashSet :
public HashSetTable<Key, Cmp>
17 typedef HashSetTable<Key, Cmp> Base;
20 void add (std::initializer_list<Key> l)
22 for (
auto it = l.begin(); it != l.end(); it++)
26 HashSet(std::initializer_list<Key> l) : Base() { add(l); }
33 <
typename Key,
typename Data,
34 template <
typename,
typename,
class>
class HashMapTable =
ODhashTable,
36 struct HashMap :
public HashMapTable<Key, Data, Cmp>
38 typedef HashMapTable<Key, Data, Cmp> Base;
41 void add (std::initializer_list<Key> lk,
42 std::initializer_list<Data> ld)
44 if (lk.size() != ld.size())
45 throw std::range_error(
"size mismatch between domain and range");
47 auto itk = lk.begin();
48 auto itd = ld.begin();
49 for (; itk != lk.end(); itk++, itd++)
50 this->insert(*itk, *itd);
55 HashMap(std::initializer_list<Key> lk,
56 std::initializer_list<Data> ld)
62 template <
template <
typename T>
class Container =
DynList>
63 HashMap(
const Container<Key> & c, std::initializer_list<Data> ld) : Base()
65 if (c.size() != ld.size())
66 throw std::range_error(
"size mismatch between domain and range");
68 auto itd = ld.begin();
69 c.for_each( [
this, &itd] (
const Key & key)
71 set_entry(key, *itd++);
75 Generate_Proxy_Operator(HashMap);
Definition: tpl_hash.H:36
Definition: tpl_hash.H:15
Definition: ahFunction.H:115
Definition: tpl_odhash.H:53