22 #ifndef COMMON_STABLEMAP_H 23 #define COMMON_STABLEMAP_H 25 #include "common/rb_tree.h" 42 template<
class Key,
class Val,
class CompFunc = Common::Less<Key> >
58 return _items.
begin();
68 return _items.
begin();
106 if (it != this->
end() && compareEqual(it->first, theKey))
117 if (it != this->
end() && compareEqual(it->first, theKey))
127 if (it == this->
end() || !compareEqual(it->first, theKey)) {
136 return _items.
erase(it);
145 return _items.
erase(first, last);
154 if (it != this->
end()) {
168 if (it == this->
end() || !compareEqual(it->first, val.first))
169 return {_items.
insert(val),
true};
175 return _items.
size();
195 if (compareEqual(it->first, key))
202 bool compareEqual(
const Key &a,
const Key &b)
const {
203 return !_comp(a, b) && !_comp(b, a);
iterator begin()
Definition: stablemap.h:57
size_t size() const
Definition: stablemap.h:174
iterator erase(iterator first, iterator last)
Definition: stablemap.h:144
Pair< Key, Val > value_type
Definition: stablemap.h:47
const_iterator end() const
Definition: stablemap.h:72
bool empty() const
Definition: stablemap.h:185
size_t erase(const Key &theKey)
Definition: stablemap.h:152
bool isEmpty() const
Definition: rb_tree.h:336
BasicIterator upperBound(const Key &key)
Definition: rb_tree.h:217
size_t count(const Key &key)
Definition: stablemap.h:192
BasicIterator lowerBound(const Key &key)
Definition: rb_tree.h:181
BasicIterator insert(const ValueType &val)
Definition: rb_tree.h:302
const_iterator begin() const
Definition: stablemap.h:67
typename TreeT::BasicIterator iterator
Definition: stablemap.h:48
Definition: stablemap.h:43
Pair< iterator, bool > insert(const value_type &val)
Definition: stablemap.h:166
iterator end()
Definition: stablemap.h:62
iterator find(const Key &theKey)
Definition: stablemap.h:104
iterator lower_bound(const Key &key)
Definition: stablemap.h:88
const_iterator find(const Key &theKey) const
Definition: stablemap.h:115
Definition: algorithm.h:29
Iterator< const Pair< Key, Val > &, const Pair< Key, Val > *> ConstIterator
Definition: rb_tree.h:123
Iterator< Pair< Key, Val > &, Pair< Key, Val > *> BasicIterator
Definition: rb_tree.h:122
const_iterator lower_bound(const Key &key) const
Definition: stablemap.h:80
iterator erase(iterator it)
Definition: stablemap.h:135
iterator upper_bound(const Key &key)
Definition: stablemap.h:96
BasicIterator erase(BasicIterator it)
Definition: rb_tree.h:250
void clear()
Definition: rb_tree.h:158
void clear()
Definition: stablemap.h:52
size_t size() const
Definition: rb_tree.h:327
Val & operator[](const Key &theKey)
Definition: stablemap.h:125
typename TreeT::ConstIterator const_iterator
Definition: stablemap.h:49
BasicIterator begin()
Definition: rb_tree.h:166
BasicIterator end()
Definition: rb_tree.h:172