Changes in lemon/bits/map_extender.h [867:994c7df296c9:664:4137ef9aacc6] in lemon
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/map_extender.h
r867 r664 50 50 typedef typename Parent::ConstReference ConstReference; 51 51 52 typedef typename Parent::ReferenceMapTag ReferenceMapTag;53 54 52 class MapIt; 55 53 class ConstMapIt; … … 85 83 typedef typename Map::Value Value; 86 84 87 MapIt() : map(NULL){}88 89 MapIt(Invalid i) : Parent(i) , map(NULL) {}90 91 explicit MapIt(Map& _map) : map( &_map) {92 map ->notifier()->first(*this);85 MapIt() {} 86 87 MapIt(Invalid i) : Parent(i) { } 88 89 explicit MapIt(Map& _map) : map(_map) { 90 map.notifier()->first(*this); 93 91 } 94 92 95 93 MapIt(const Map& _map, const Item& item) 96 : Parent(item), map( &_map) {}94 : Parent(item), map(_map) {} 97 95 98 96 MapIt& operator++() { 99 map ->notifier()->next(*this);97 map.notifier()->next(*this); 100 98 return *this; 101 99 } 102 100 103 101 typename MapTraits<Map>::ConstReturnValue operator*() const { 104 return (*map)[*this];102 return map[*this]; 105 103 } 106 104 107 105 typename MapTraits<Map>::ReturnValue operator*() { 108 return (*map)[*this];106 return map[*this]; 109 107 } 110 108 111 109 void set(const Value& value) { 112 map ->set(*this, value);113 } 114 115 protected: 116 Map *map;110 map.set(*this, value); 111 } 112 113 protected: 114 Map& map; 117 115 118 116 }; … … 125 123 typedef typename Map::Value Value; 126 124 127 ConstMapIt() : map(NULL){}128 129 ConstMapIt(Invalid i) : Parent(i) , map(NULL) {}130 131 explicit ConstMapIt(Map& _map) : map( &_map) {132 map ->notifier()->first(*this);125 ConstMapIt() {} 126 127 ConstMapIt(Invalid i) : Parent(i) { } 128 129 explicit ConstMapIt(Map& _map) : map(_map) { 130 map.notifier()->first(*this); 133 131 } 134 132 … … 137 135 138 136 ConstMapIt& operator++() { 139 map ->notifier()->next(*this);137 map.notifier()->next(*this); 140 138 return *this; 141 139 } … … 146 144 147 145 protected: 148 const Map *map;146 const Map& map; 149 147 }; 150 148 … … 153 151 154 152 public: 155 ItemIt() : map(NULL) {} 156 157 158 ItemIt(Invalid i) : Parent(i) , map(NULL) {}159 160 explicit ItemIt(Map& _map) : map( &_map) {161 map ->notifier()->first(*this);153 154 ItemIt() {} 155 156 ItemIt(Invalid i) : Parent(i) { } 157 158 explicit ItemIt(Map& _map) : map(_map) { 159 map.notifier()->first(*this); 162 160 } 163 161 164 162 ItemIt(const Map& _map, const Item& item) 165 : Parent(item), map( &_map) {}163 : Parent(item), map(_map) {} 166 164 167 165 ItemIt& operator++() { 168 map ->notifier()->next(*this);169 return *this; 170 } 171 172 protected: 173 const Map *map;166 map.notifier()->next(*this); 167 return *this; 168 } 169 170 protected: 171 const Map& map; 174 172 175 173 }; … … 194 192 typedef typename Parent::ConstReference ConstReference; 195 193 196 typedef typename Parent::ReferenceMapTag ReferenceMapTag;197 198 194 class MapIt; 199 195 class ConstMapIt; … … 232 228 typedef typename Map::Value Value; 233 229 234 MapIt() : map(NULL){}235 236 MapIt(Invalid i) : Parent(i) , map(NULL){ }237 238 explicit MapIt(Map& _map) : map( &_map) {239 map ->graph.first(*this);230 MapIt() {} 231 232 MapIt(Invalid i) : Parent(i) { } 233 234 explicit MapIt(Map& _map) : map(_map) { 235 map.graph.first(*this); 240 236 } 241 237 242 238 MapIt(const Map& _map, const Item& item) 243 : Parent(item), map( &_map) {}239 : Parent(item), map(_map) {} 244 240 245 241 MapIt& operator++() { 246 map ->graph.next(*this);242 map.graph.next(*this); 247 243 return *this; 248 244 } 249 245 250 246 typename MapTraits<Map>::ConstReturnValue operator*() const { 251 return (*map)[*this];247 return map[*this]; 252 248 } 253 249 254 250 typename MapTraits<Map>::ReturnValue operator*() { 255 return (*map)[*this];251 return map[*this]; 256 252 } 257 253 258 254 void set(const Value& value) { 259 map ->set(*this, value);260 } 261 262 protected: 263 Map *map;255 map.set(*this, value); 256 } 257 258 protected: 259 Map& map; 264 260 265 261 }; … … 272 268 typedef typename Map::Value Value; 273 269 274 ConstMapIt() : map(NULL){}275 276 ConstMapIt(Invalid i) : Parent(i) , map(NULL){ }277 278 explicit ConstMapIt(Map& _map) : map( &_map) {279 map ->graph.first(*this);270 ConstMapIt() {} 271 272 ConstMapIt(Invalid i) : Parent(i) { } 273 274 explicit ConstMapIt(Map& _map) : map(_map) { 275 map.graph.first(*this); 280 276 } 281 277 282 278 ConstMapIt(const Map& _map, const Item& item) 283 : Parent(item), map( &_map) {}279 : Parent(item), map(_map) {} 284 280 285 281 ConstMapIt& operator++() { 286 map ->graph.next(*this);282 map.graph.next(*this); 287 283 return *this; 288 284 } 289 285 290 286 typename MapTraits<Map>::ConstReturnValue operator*() const { 291 return (*map)[*this];292 } 293 294 protected: 295 const Map *map;287 return map[*this]; 288 } 289 290 protected: 291 const Map& map; 296 292 }; 297 293 … … 300 296 301 297 public: 302 ItemIt() : map(NULL) {} 303 304 305 ItemIt(Invalid i) : Parent(i) , map(NULL){ }306 307 explicit ItemIt(Map& _map) : map( &_map) {308 map ->graph.first(*this);298 299 ItemIt() {} 300 301 ItemIt(Invalid i) : Parent(i) { } 302 303 explicit ItemIt(Map& _map) : map(_map) { 304 map.graph.first(*this); 309 305 } 310 306 311 307 ItemIt(const Map& _map, const Item& item) 312 : Parent(item), map( &_map) {}308 : Parent(item), map(_map) {} 313 309 314 310 ItemIt& operator++() { 315 map ->graph.next(*this);316 return *this; 317 } 318 319 protected: 320 const Map *map;311 map.graph.next(*this); 312 return *this; 313 } 314 315 protected: 316 const Map& map; 321 317 322 318 };
Note: See TracChangeset
for help on using the changeset viewer.