Changeset 702:4207f82a1778 in lemon-0.x for src/work/deba/vector_map_factory.h
- Timestamp:
- 07/14/04 23:16:10 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@953
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/deba/vector_map_factory.h
r700 r702 4 4 #include <vector> 5 5 #include <iostream> 6 7 #include "extended_pair.h" 6 8 7 9 namespace hugo { … … 156 158 } 157 159 160 161 class Pointer { 162 friend class iterator; 163 private: 164 typedef extended_pair<const Key&, const Key&, Value&, Value&> Pair; 165 Pair data; 166 Pointer(const Key& key, Value& val) : data(key, val) {} 167 public: 168 Pair* operator->() {return &data;} 169 }; 170 158 171 /** Arrow operator for map. 159 172 */ 160 std::pair<const Key, Value>* operator->() { 161 static std::pair<const Key, Value> tmp = operator*(); 162 return &tmp; 173 Pointer operator->() { 174 return Pointer(it, ((*map)[it])); 163 175 } 164 176 … … 189 201 return !(*this == p_it); 190 202 } 203 191 204 192 205 private: … … 235 248 } 236 249 250 class Pointer { 251 friend class const_iterator; 252 private: 253 typedef extended_pair<const Key&, const Key&, const Value&, const Value&> Pair; 254 Pair data; 255 Pointer(const Key& key, const Value& val) : data(key, val) {} 256 public: 257 Pair* operator->() {return &data;} 258 }; 237 259 /** Arrow operator for map. 238 260 */ 239 std::pair<const Key, const Value>* operator->() const { 240 static std::pair<const Key, const Value> tmp = operator*(); 241 return &tmp; 261 Pointer operator->() const { 262 return Pointer(it, (*map)[it]); 242 263 } 243 264 … … 269 290 } 270 291 292 271 293 private: 272 294 const Map* map;
Note: See TracChangeset
for help on using the changeset viewer.