Changeset 2384:805c5a2a36dd in lemon-0.x for lemon/bits/vector_map.h
- Timestamp:
- 03/01/07 18:14:24 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3215
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/vector_map.h
r2260 r2384 91 91 /// It adds all the items of the graph to the map. 92 92 VectorMap(const Graph& graph) { 93 Parent::attach(graph. getNotifier(Item()));94 container.resize(Parent:: getNotifier()->maxId() + 1);93 Parent::attach(graph.notifier(Item())); 94 container.resize(Parent::notifier()->maxId() + 1); 95 95 } 96 96 … … 100 100 /// It adds all the items of the graph to the map. 101 101 VectorMap(const Graph& graph, const Value& value) { 102 Parent::attach(graph. getNotifier(Item()));103 container.resize(Parent:: getNotifier()->maxId() + 1, value);102 Parent::attach(graph.notifier(Item())); 103 container.resize(Parent::notifier()->maxId() + 1, value); 104 104 } 105 105 … … 109 109 VectorMap(const VectorMap& _copy) : Parent() { 110 110 if (_copy.attached()) { 111 Parent::attach(*_copy. getNotifier());111 Parent::attach(*_copy.notifier()); 112 112 container = _copy.container; 113 113 } … … 135 135 VectorMap& operator=(const CMap& cmap) { 136 136 checkConcept<concepts::ReadMap<Key, _Value>, CMap>(); 137 const typename Parent::Notifier* notifier = Parent:: getNotifier();137 const typename Parent::Notifier* notifier = Parent::notifier(); 138 138 Item it; 139 139 for (notifier->first(it); it != INVALID; notifier->next(it)) { … … 150 150 /// actual items of the graph. 151 151 Reference operator[](const Key& key) { 152 return container[Parent:: getNotifier()->id(key)];152 return container[Parent::notifier()->id(key)]; 153 153 } 154 154 … … 158 158 /// actual items of the graph. 159 159 ConstReference operator[](const Key& key) const { 160 return container[Parent:: getNotifier()->id(key)];160 return container[Parent::notifier()->id(key)]; 161 161 } 162 162 … … 176 176 /// and it overrides the add() member function of the observer base. 177 177 virtual void add(const Key& key) { 178 int id = Parent:: getNotifier()->id(key);178 int id = Parent::notifier()->id(key); 179 179 if (id >= (int)container.size()) { 180 180 container.resize(id + 1); … … 189 189 int max = container.size() - 1; 190 190 for (int i = 0; i < (int)keys.size(); ++i) { 191 int id = Parent:: getNotifier()->id(keys[i]);191 int id = Parent::notifier()->id(keys[i]); 192 192 if (id >= max) { 193 193 max = id; … … 202 202 /// and it overrides the erase() member function of the observer base. 203 203 virtual void erase(const Key& key) { 204 container[Parent:: getNotifier()->id(key)] = Value();204 container[Parent::notifier()->id(key)] = Value(); 205 205 } 206 206 … … 211 211 virtual void erase(const std::vector<Key>& keys) { 212 212 for (int i = 0; i < (int)keys.size(); ++i) { 213 container[Parent:: getNotifier()->id(keys[i])] = Value();213 container[Parent::notifier()->id(keys[i])] = Value(); 214 214 } 215 215 } … … 220 220 /// and it overrides the build() member function of the observer base. 221 221 virtual void build() { 222 int size = Parent:: getNotifier()->maxId() + 1;222 int size = Parent::notifier()->maxId() + 1; 223 223 container.reserve(size); 224 224 container.resize(size);
Note: See TracChangeset
for help on using the changeset viewer.