|
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
21 #ifndef ELM_AVL_MAP_CPP_
22 #define ELM_AVL_MAP_CPP_
24 #include <elm/delegate.h>
25 #include <elm/util/Option.h>
26 #include <elm/avl/GenTree.h>
27 #include <elm/data/util.h>
29 namespace elm {
namespace avl {
32 template <
class K,
class T,
class C = Comparator<K>,
class E = Equiv<T>,
class A = DefaultAlloc >
50 {
for(
const auto y: *
this)
if(!E::isEqual(x, y))
return false;
return true; }
52 {
for(
const auto x: c)
if(!
contains(x))
return false;
return true; }
61 inline const T&
item()
const {
return i.
item().snd; }
67 inline Iter
begin()
const {
return Iter(*
this); }
68 inline Iter
end()
const {
return Iter(); }
77 inline const T&
get(
const K& key,
const T&
def)
const
78 {
const pair_t *
p = tree.
get(key);
if(!
p)
return def;
else return p->snd; }
79 inline bool hasKey(
const K& key)
const
90 inline const K&
item(
void)
const {
return it.
item().fst; }
bool ended(void) const
Definition: Map.h:88
void remove(const T &x)
Definition: GenTree.h:232
Iter()
Definition: Map.h:58
KeyIter(const self_t &map)
Definition: Map.h:87
Printable< T, M > p(const T &data, const M &man)
Definition: Output.h:302
Iterable< I > subiter(const I &b, const I &e)
Definition: util.h:231
bool equals(const Iter &ii) const
Definition: Map.h:63
bool contains(const T &x) const
Definition: Map.h:49
Iterable< KeyIter > keys() const
Definition: Map.h:95
T2 snd
Definition: Pair.h:36
void clear(void)
Definition: Map.h:110
void next(void)
Definition: GenTree.h:171
bool isEmpty(void) const
Definition: Map.h:53
static Equiv< T > def
Definition: equiv.h:37
const C & comparator() const
Definition: GenTree.h:136
bool equals(const Iter &i) const
Definition: GenTree.h:180
C & allocator()
Definition: Map.h:43
int count(void) const
Definition: Map.h:48
Definition: GenTree.h:165
Iter(const self_t &t)
Definition: Map.h:59
bool isEmpty(void) const
Definition: GenTree.h:162
Option< T > some(const T &val)
Definition: Option.h:81
int count(void) const
Definition: GenTree.h:157
void map(const C &c, const F &f, D &d)
Definition: util.h:89
const T & item() const
Definition: Map.h:61
void clear(void)
Definition: GenTree.h:206
const T & operator[](const K &k) const
Definition: Map.h:81
const T & get(const K &key, const T &def) const
Definition: Map.h:77
const T & item(void) const
Definition: GenTree.h:179
bool equals(const KeyIter &i) const
Definition: Map.h:91
void put(const K &key, const T &value)
Definition: Map.h:105
Option< T > get(const K &key) const
Definition: Map.h:75
var_t embed_t
Definition: type_info.h:66
const OptionalNone none
Definition: util_Option.cpp:154
Iter begin() const
Definition: Map.h:67
bool ended() const
Definition: Map.h:60
T * get(const typename K::key_t &key)
Definition: GenTree.h:141
const C & allocatr() const
Definition: Map.h:42
void copy(const Map< K, T, C > &map)
Definition: Map.h:111
C & comparator()
Definition: Map.h:41
void next(void)
Definition: Map.h:89
bool hasKey(const K &key) const
Definition: Map.h:79
bool operator==(const Map< K, T, C > &map) const
Definition: Map.h:71
void remove(const Iter &i)
Definition: Map.h:107
PairIter(const self_t &map)
Definition: Map.h:100
const A & allocator() const
Definition: GenTree.h:138
void remove(const K &key)
Definition: Map.h:106
bool equals(const GenTree< T, K, C > &tree) const
Definition: GenTree.h:195
bool containsAll(const CC &c) const
Definition: Map.h:51
PairIter()
Definition: Map.h:99
KeyIter()
Definition: Map.h:86
Definition: delegate.h:87
Iterable< PairIter > pairs() const
Definition: Map.h:102
Map< K, T, C > & operator=(const Map< K, T, C > &map)
Definition: Map.h:112
const K & item(void) const
Definition: Map.h:90
bool operator!=(const Map< K, T, C > &map) const
Definition: Map.h:72
bool ended(void) const
Definition: GenTree.h:170
const E & equivalence() const
Definition: Map.h:44
const C & comparator() const
Definition: Map.h:40
void copy(const GenTree< T, K, C > &tree)
Definition: GenTree.h:242
void set(const T &item)
Definition: GenTree.h:145
bool equals(const Map< K, T, C > &map) const
Definition: Map.h:70
void removeByKey(const typename K::key_t &item)
Definition: GenTree.h:148
E & equivalence()
Definition: Map.h:45
Iter end() const
Definition: Map.h:68
void next()
Definition: Map.h:62
Map< K, T, C, E, A > self_t
Definition: Map.h:38