1 # ifndef TPL_DYNMAPTREE_H
2 # define TPL_DYNMAPTREE_H
4 # include <tpl_dynSetTree.H>
33 typename Key,
typename Data,
34 template <
typename,
class>
class Tree =
Avl_Tree,
37 public DynSetTree<std::pair<Key, Data>, Tree, Dft_Pair_Cmp<Key, Data, Compare>>
39 typedef std::pair<Key, Data> Pair;
47 typedef Key Item_Type;
49 typedef Data Value_Type;
53 Data & get_data(
const Key & key)
55 return key_to_pair<Key, Data>(&
const_cast<Key&
>(key))->second;
58 const Key & get_key(Data * data_ptr)
60 return data_to_pair<Key, Data>(data_ptr)->first;
74 Key *
insert(
const Key & key,
const Data & data)
77 return p != NULL ? &p->first : NULL;
80 Key *
insert(
const Key & key, Data && data = Data())
82 Pair * p = this->
Base::insert(Pair(key, std::move(data)));
83 return p != NULL ? &p->first : NULL;
86 Key *
insert(Key && key,
const Data & data)
88 Pair * p = this->
Base::insert(Pair(std::move(key), data));
89 return p != NULL ? &p->first : NULL;
92 Key *
insert(Key && key, Data && data = Data())
94 Pair * p = this->
Base::insert(Pair(std::move(key), std::move(data)));
95 return p != NULL ? &p->first : NULL;
141 Key *
put(
const Key & key,
const Data & data)
146 Key *
put(
const Key & key, Data && data)
148 return insert(key, std::move(data));
151 Key *
put(Key && key,
const Data & data)
153 return insert(std::move(key), data);
156 Key *
put(Key && key, Data && data)
158 return insert(std::move(key), std::move(data));
169 size_t remove(
const Key & key)
180 bool has(
const Key & key)
const {
return test_key(key); }
194 return p != NULL ? &p->second : NULL;
210 return p != NULL ? &p->second : NULL;
225 return this->
Base::find(Pair(key, Data())).second;
228 Map_Sequences_Methods();
235 # include <tpl_binTree.H>
236 # include <tpl_avl.H>
237 # include <tpl_rb_tree.H>
238 # include <tpl_rand_tree.H>
239 # include <tpl_treap.H>
240 # include <tpl_treapRk.H>
241 # include <tpl_splay_tree.H>
250 template <
typename Key,
typename Type,
class Compare = Aleph::less<Key> >
259 template <
typename Key,
typename Type,
class Compare = Aleph::less<Key> >
267 template <
typename Key,
typename Type,
class Compare = Aleph::less<Key> >
278 template <
typename Key,
typename Type,
class Compare = Aleph::less<Key> >
288 template <
typename Key,
typename Type,
class Compare = Aleph::less<Key> >
299 template <
typename Key,
typename Type,
class Compare = Aleph::less<Key> >
309 template <
typename Key,
typename Type,
class Compare = Aleph::less<Key> >
Data * test(const Key &key)
Definition: tpl_dynMapTree.H:191
Definition: tpl_dynMapTree.H:260
size_t remove(const Key &key)
Definition: tpl_dynSetTree.H:274
Definition: ahFunction.H:145
Definition: tpl_dynMapTree.H:36
Key * search(const Key &key) const
Definition: tpl_dynSetTree.H:364
Key * search_or_insert(const Key &key, const Data &data)
Definition: tpl_dynMapTree.H:110
Key * put(const Key &key, const Data &data)
Definition: tpl_dynMapTree.H:141
Definition: tpl_dynMapTree.H:300
Definition: tpl_dynMapTree.H:279
Definition: tpl_dynMapTree.H:251
Definition: tpl_dynMapTree.H:268
Key & find(const Key &key)
Definition: tpl_dynSetTree.H:316
Definition: tpl_dynMapTree.H:310
Definition: tpl_dynMapTree.H:289
bool test_key(const Key &key) const
Retorna true si key está presente dentro del mapeo.
Definition: tpl_dynMapTree.H:175
bool exist(const Key &key) const
Retorna true si key pertenece al conjunto dinámico.
Definition: tpl_dynSetTree.H:287
Definition: tpl_dynSetTree.H:34
Definition: tpl_avl.H:573
Key * search_or_insert(const Key &key)
Definition: tpl_dynSetTree.H:225
Key * insert(const Key &key, const Data &data)
Definition: tpl_dynMapTree.H:74
Key * insert(const Key &key)
Definition: tpl_dynSetTree.H:177
Data * search(const Key &key) const
Definition: tpl_dynMapTree.H:207
Data & find(const Key &key)
Definition: tpl_dynMapTree.H:223