Changeset 844:9bf990cb066d in lemon-0.x for src
- Timestamp:
- 09/13/04 22:05:13 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1143
- Location:
- src
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/Makefile.am
r843 r844 18 18 map_iterator.h \ 19 19 map_registry.h \ 20 map_bits.h \ 20 21 maps.h \ 21 22 mincostflows.h \ -
src/hugo/array_map.h
r830 r844 6 6 7 7 #include <hugo/map_iterator.h> 8 #include <hugo/map_bits.h> 8 9 9 10 ///\ingroup graphmaps … … 72 73 allocate_memory(); 73 74 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 74 int id = MapBase::getGraph()->id(it);75 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 75 76 allocator.construct(&(values[id]), Value()); 76 77 } … … 83 84 allocate_memory(); 84 85 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 85 int id = MapBase::getGraph()->id(it);86 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 86 87 allocator.construct(&(values[id]), v); 87 88 } … … 95 96 values = allocator.allocate(capacity); 96 97 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 97 int id = MapBase::getGraph()->id(it);98 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 98 99 allocator.construct(&(values[id]), copy.values[id]); 99 100 } … … 124 125 values = allocator.allocate(capacity); 125 126 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 126 int id = MapBase::getGraph()->id(it);127 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 127 128 allocator.construct(&(values[id]), copy.values[id]); 128 129 } … … 133 134 */ 134 135 template <typename CMap> ArrayMap& operator=(const CMap& copy) { 135 if ( MapBase::getGraph()) {136 if (capacity != 0) { 136 137 MapBase::destroy(); 137 } 138 allocator.deallocate(values, capacity); 139 } 138 140 MapBase::operator=(copy); 139 141 if (MapBase::getGraph()) { … … 161 163 */ 162 164 ReferenceType operator[](const KeyType& key) { 163 int id = MapBase::getGraph()->id(key);165 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key); 164 166 return values[id]; 165 167 } … … 170 172 */ 171 173 ConstReferenceType operator[](const KeyType& key) const { 172 int id = MapBase::getGraph()->id(key);174 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key); 173 175 return values[id]; 174 176 } … … 178 180 */ 179 181 void set(const KeyType& key, const ValueType& val) { 180 int id = MapBase::getGraph()->id(key);182 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key); 181 183 values[id] = val; 182 184 } … … 185 187 */ 186 188 void add(const KeyType& key) { 187 int id = MapBase::getGraph()->id(key);189 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key); 188 190 if (id >= capacity) { 189 191 int new_capacity = (capacity == 0 ? 1 : capacity); … … 193 195 Value* new_values = allocator.allocate(new_capacity);; 194 196 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 195 int jd = MapBase::getGraph()->id(it);197 int jd = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 196 198 if (id != jd) { 197 199 allocator.construct(&(new_values[jd]), values[jd]); … … 209 211 */ 210 212 void erase(const KeyType& key) { 211 int id = MapBase::getGraph()->id(key);213 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key); 212 214 allocator.destroy(&(values[id])); 213 215 } … … 279 281 280 282 void allocate_memory() { 281 int max_id = -1; 282 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 283 int id = MapBase::getGraph()->id(it); 284 if (id > max_id) { 285 max_id = id; 286 } 287 } 283 int max_id = KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph()); 288 284 if (max_id == -1) { 289 285 capacity = 0; … … 301 297 Value* values; 302 298 Allocator allocator; 299 300 public: 301 // STL compatibility typedefs. 302 typedef Iterator iterator; 303 typedef ConstIterator const_iterator; 304 typedef typename Iterator::PairValueType value_type; 305 typedef typename Iterator::KeyType key_type; 306 typedef typename Iterator::ValueType data_type; 307 typedef typename Iterator::PairReferenceType reference; 308 typedef typename Iterator::PairPointerType pointer; 309 typedef typename ConstIterator::PairReferenceType const_reference; 310 typedef typename ConstIterator::PairPointerType const_pointer; 311 typedef int difference_type; 303 312 }; 304 313 -
src/hugo/graph_wrapper.h
r838 r844 1389 1389 void erase(const Edge& e) const { 1390 1390 Node n=tail(e); 1391 typename Graph::OutEdgeIt f(* graph, n);1391 typename Graph::OutEdgeIt f(*Parent::graph, n); 1392 1392 ++f; 1393 1393 first_out_edges->set(n, f); -
src/hugo/list_graph.h
r827 r844 1115 1115 OutEdgeIt(const EdgeSet& _G,const Node v) : 1116 1116 Edge(_G.nodes[v].first_out), G(&_G) { } 1117 OutEdgeIt &operator++() { n = G->edges[n].next_out; return *this; } 1117 OutEdgeIt &operator++() { 1118 Edge::n = G->edges[Edge::n].next_out; 1119 return *this; 1120 } 1118 1121 }; 1119 1122 … … 1127 1130 InEdgeIt(const EdgeSet& _G,Node v) 1128 1131 : Edge(_G.nodes[v].first_in), G(&_G) { } 1129 InEdgeIt &operator++() { n=G->edges[n].next_in; return *this; } 1132 InEdgeIt &operator++() { 1133 Edge::n = G->edges[Edge::n].next_in; 1134 return *this; 1135 } 1130 1136 }; 1131 1137 -
src/hugo/map_defines.h
r822 r844 97 97 typedef SymEdgeIt<Graph, Edge, EdgeIt> SymEdgeIt; \ 98 98 typedef MapRegistry<Graph, Edge, SymEdgeIt> SymEdgeMapRegistry; \ 99 mutable EdgeMapRegistry sym_edge_maps;99 mutable SymEdgeMapRegistry sym_edge_maps; 100 100 101 101 -
src/hugo/map_iterator.h
r830 r844 2 2 #ifndef MAP_ITERATOR_H 3 3 #define MAP_ITERATOR_H 4 5 #include <iterator> 4 6 5 7 #include <hugo/extended_pair.h> … … 23 25 24 26 public: 27 25 28 /// The key type of the iterator. 26 29 typedef typename Map::KeyType KeyType; … … 80 83 friend class MapConstIterator<Map>; 81 84 82 public: 85 86 public: 87 88 /// The iterator base class. 89 typedef MapIteratorBase<Map> Base; 83 90 84 91 /// The key type of the iterator. … … 102 109 103 110 public: 111 112 /// The value type of the iterator. 113 typedef extended_pair<KeyType, const KeyType&, 114 ValueType, const ValueType&> PairValueType; 104 115 105 116 /// The reference type of the iterator. … … 112 123 /// Constructor to initalize the iterators returned 113 124 /// by the begin() and end(). 114 MapIterator(Map& pmap, const KeyIt& pit) 115 : MapIteratorBase<Map>(pit), map(&pmap) {} 125 MapIterator(Map& pmap, const KeyIt& pit) : Base(pit), map(&pmap) {} 116 126 117 127 /// Dereference operator for the iterator. 118 128 PairReferenceType operator*() { 119 return PairReferenceType( it, (*map)[it]);129 return PairReferenceType(Base::it, (*map)[Base::it]); 120 130 } 121 131 … … 133 143 /// Arrow operator for the iterator. 134 144 PairPointerType operator->() { 135 return PairPointerType( it, ((*map)[it]));145 return PairPointerType(Base::it, ((*map)[Base::it])); 136 146 } 137 147 138 148 /// The pre increment operator of the iterator. 139 149 MapIterator& operator++() { 140 increment();150 Base::increment(); 141 151 return *this; 142 152 } … … 144 154 /// The post increment operator of the iterator. 145 155 MapIterator operator++(int) { 146 MapIterator tmp( it);147 increment();156 MapIterator tmp(*this); 157 Base::increment(); 148 158 return tmp; 149 159 } … … 151 161 private: 152 162 Map* map; 163 164 public: 165 // STL compatibility typedefs. 166 typedef std::forward_iterator_tag iterator_category; 167 typedef int difference_type; 168 typedef PairValueType value_type; 169 typedef PairReferenceType reference; 170 typedef PairPointerType pointer; 153 171 }; 154 172 … … 160 178 161 179 public: 180 181 /// The iterator base class. 182 typedef MapIteratorBase<Map> Base; 162 183 163 184 /// The key type of the iterator. … … 188 209 /// by the begin() and end(). 189 210 MapConstIterator(const Map& pmap, const KeyIt& pit) 190 : MapIteratorBase<Map>(pit), map(&pmap) {}211 : Base(pit), map(&pmap) {} 191 212 192 213 /// Constructor to create const iterator from a non const. 193 214 MapConstIterator(const MapIterator<Map>& pit) { 194 it = pit.it;215 Base::it = pit.Base::it; 195 216 map = pit.map; 196 217 } 218 219 /// The value type of the iterator. 220 typedef extended_pair<KeyType, const KeyType&, 221 ValueType, const ValueType&> PairValueType; 197 222 198 223 /// The reference type of map. … … 202 227 /// Dereference operator for the iterator. 203 228 PairReferenceType operator*() { 204 return PairReferenceType( it, (*map)[it]);229 return PairReferenceType(Base::it, (*map)[Base::it]); 205 230 } 206 231 … … 218 243 /// Arrow operator for the iterator. 219 244 PairPointerType operator->() { 220 return PairPointerType( it, ((*map)[it]));245 return PairPointerType(Base::it, (*map)[Base::it]); 221 246 } 222 247 223 248 /// The pre increment operator of the iterator. 224 249 MapConstIterator& operator++() { 225 increment();250 Base::increment(); 226 251 return *this; 227 252 } … … 229 254 /// The post increment operator of the iterator. 230 255 MapConstIterator operator++(int) { 231 MapConstIterator <Map> tmp(it);232 increment();256 MapConstIterator tmp(*this); 257 Base::increment(); 233 258 return tmp; 234 259 } … … 236 261 private: 237 262 const Map* map; 263 264 public: 265 // STL compatibility typedefs. 266 typedef std::input_iterator_tag iterator_category; 267 typedef int difference_type; 268 typedef PairValueType value_type; 269 typedef PairReferenceType reference; 270 typedef PairPointerType pointer; 238 271 }; 239 272 … … 246 279 public: 247 280 281 /// The iterator base class. 282 typedef MapIteratorBase<Map> Base; 283 248 284 /// The key type of the iterator. 249 285 typedef typename Map::KeyType KeyType; … … 257 293 258 294 /// KeyIt initialized iterator. 259 MapKeyIterator(const KeyIt& pit) : MapIteratorBase<Map>(pit) {}295 MapKeyIterator(const KeyIt& pit) : Base(pit) {} 260 296 261 297 /// The pre increment operator of the iterator. 262 298 MapKeyIterator& operator++() { 263 increment();299 Base::increment(); 264 300 return *this; 265 301 } … … 268 304 MapKeyIterator operator++(int) { 269 305 MapKeyIterator tmp(*this); 270 increment();306 Base::increment(); 271 307 return tmp; 272 308 } … … 274 310 /// The dereferencing operator of the iterator. 275 311 KeyType operator*() const { 276 return static_cast<KeyType>(it); 277 } 312 return static_cast<KeyType>(Base::it); 313 } 314 315 public: 316 // STL compatibility typedefs. 317 typedef std::input_iterator_tag iterator_category; 318 typedef int difference_type; 319 typedef KeyType value_type; 320 typedef const KeyType& reference; 321 typedef const KeyType* pointer; 278 322 }; 279 323 280 324 template <typename Map> class MapConstValueIterator; 281 325 326 /** MapValueIterator creates an stl compatible iterator 327 * for the values. 328 */ 282 329 template <typename Map> 283 330 class MapValueIterator : public MapIteratorBase<Map> { … … 286 333 287 334 public: 335 336 /// The iterator base class. 337 typedef MapIteratorBase<Map> Base; 288 338 289 339 /// The key type of the iterator. … … 318 368 /// Map and KeyIt initialized iterator. 319 369 MapValueIterator(Map& pmap, const KeyIt& pit) 320 : MapIteratorBase<Map>(pit), map(&pmap) {}370 : Base(pit), map(&pmap) {} 321 371 322 372 323 373 /// The pre increment operator of the iterator. 324 374 MapValueIterator& operator++() { 325 increment();375 Base::increment(); 326 376 return *this; 327 377 } … … 330 380 MapValueIterator operator++(int) { 331 381 MapValueIterator tmp(*this); 332 increment();382 Base::increment(); 333 383 return tmp; 334 384 } … … 336 386 /// The dereferencing operator of the iterator. 337 387 ReferenceType operator*() const { 338 return (*map)[ it];388 return (*map)[Base::it]; 339 389 } 340 390 … … 344 394 } 345 395 346 }; 347 396 public: 397 // STL compatibility typedefs. 398 typedef std::forward_iterator_tag iterator_category; 399 typedef int difference_type; 400 typedef ValueType value_type; 401 typedef ReferenceType reference; 402 typedef PointerType pointer; 403 }; 404 405 /** MapValueIterator creates an stl compatible iterator 406 * for the const values. 407 */ 348 408 349 409 template <typename Map> … … 352 412 public: 353 413 354 /// The key type of the iterator. 355 typedef typename Map::KeyType KeyType; 356 /// The iterator to iterate on the keys. 357 typedef typename Map::KeyIt KeyIt; 358 414 /// The iterator base class. 415 typedef MapIteratorBase<Map> Base; 416 417 /// The key type of the iterator. 418 typedef typename Map::KeyType KeyType; 419 /// The iterator to iterate on the keys. 420 typedef typename Map::KeyIt KeyIt; 359 421 360 422 /// The value type of the iterator. … … 383 445 /// Constructor to create const iterator from a non const. 384 446 MapConstValueIterator(const MapValueIterator<Map>& pit) { 385 it = pit.it;447 Base::it = pit.Base::it; 386 448 map = pit.map; 387 449 } … … 389 451 /// Map and KeyIt initialized iterator. 390 452 MapConstValueIterator(const Map& pmap, const KeyIt& pit) 391 : MapIteratorBase<Map>(pit), map(&pmap) {}453 : Base(pit), map(&pmap) {} 392 454 393 455 /// The pre increment operator of the iterator. 394 456 MapConstValueIterator& operator++() { 395 increment();457 Base::increment(); 396 458 return *this; 397 459 } … … 400 462 MapConstValueIterator operator++(int) { 401 463 MapConstValueIterator tmp(*this); 402 increment();464 Base::increment(); 403 465 return tmp; 404 466 } … … 406 468 /// The dereferencing operator of the iterator. 407 469 ConstReferenceType operator*() const { 408 return (*map)[ it];470 return (*map)[Base::it]; 409 471 } 410 472 … … 414 476 } 415 477 478 public: 479 // STL compatibility typedefs. 480 typedef std::input_iterator_tag iterator_category; 481 typedef int difference_type; 482 typedef ValueType value_type; 483 typedef ConstReferenceType reference; 484 typedef ConstPointerType pointer; 416 485 }; 417 486 … … 431 500 /// The iterator to iterate on the keys. 432 501 typedef typename Map::KeyIt KeyIt; 502 503 504 /// The value type of the iterator. 505 typedef typename Map::ValueType ValueType; 506 /// The reference type of the iterator. 507 typedef typename Map::ReferenceType ReferenceType; 508 /// The pointer type of the iterator. 509 typedef typename Map::PointerType PointerType; 510 511 /// The const value type of the iterator. 512 typedef typename Map::ConstValueType ConstValueType; 513 /// The const reference type of the iterator. 514 typedef typename Map::ConstReferenceType ConstReferenceType; 515 /// The pointer type of the iterator. 516 typedef typename Map::ConstPointerType ConstPointerType; 433 517 434 518 /// The map initialized const key set. … … 447 531 return ConstIterator(KeyIt(INVALID)); 448 532 } 533 534 public: 535 // STL compatibility typedefs. 536 typedef ValueType value_type; 537 typedef ConstIterator const_iterator; 538 typedef ConstReferenceType const_reference; 539 typedef ConstPointerType const_pointer; 540 typedef int difference_type; 449 541 }; 450 542 … … 465 557 typedef typename Map::KeyIt KeyIt; 466 558 559 560 /// The value type of the iterator. 561 typedef typename Map::ValueType ValueType; 562 /// The reference type of the iterator. 563 typedef typename Map::ReferenceType ReferenceType; 564 /// The pointer type of the iterator. 565 typedef typename Map::PointerType PointerType; 566 567 /// The const value type of the iterator. 568 typedef typename Map::ConstValueType ConstValueType; 569 /// The const reference type of the iterator. 570 typedef typename Map::ConstReferenceType ConstReferenceType; 571 /// The pointer type of the iterator. 572 typedef typename Map::ConstPointerType ConstPointerType; 573 467 574 /// The map initialized const value set. 468 575 MapConstValueSet(const Map& pmap) : map(&pmap) {} … … 480 587 return ConstIterator(*map, KeyIt(INVALID)); 481 588 } 589 590 public: 591 // STL compatibility typedefs. 592 typedef ValueType value_type; 593 typedef ConstIterator const_iterator; 594 typedef ConstReferenceType const_reference; 595 typedef ConstPointerType const_pointer; 596 typedef int difference_type; 482 597 }; 483 598 … … 499 614 typedef typename Map::KeyIt KeyIt; 500 615 616 617 /// The value type of the iterator. 618 typedef typename Map::ValueType ValueType; 619 /// The reference type of the iterator. 620 typedef typename Map::ReferenceType ReferenceType; 621 /// The pointer type of the iterator. 622 typedef typename Map::PointerType PointerType; 623 624 /// The const value type of the iterator. 625 typedef typename Map::ConstValueType ConstValueType; 626 /// The const reference type of the iterator. 627 typedef typename Map::ConstReferenceType ConstReferenceType; 628 /// The pointer type of the iterator. 629 typedef typename Map::ConstPointerType ConstPointerType; 630 501 631 /// The map initialized value set. 502 632 MapValueSet(Map& pmap) : map(&pmap) {} … … 528 658 } 529 659 660 public: 661 // STL compatibility typedefs. 662 typedef ValueType value_type; 663 typedef Iterator iterator; 664 typedef ConstIterator const_iterator; 665 typedef ReferenceType reference; 666 typedef ConstReferenceType const_reference; 667 typedef PointerType pointer; 668 typedef ConstPointerType const_pointer; 669 typedef int difference_type; 670 530 671 }; 531 672 -
src/hugo/sym_map.h
r822 r844 18 18 */ 19 19 20 20 21 template <typename Graph, typename Edge, typename EdgeIt> 21 22 class SymEdgeIt : public EdgeIt { … … 31 32 SymEdgeIt(const Graph& graph) 32 33 : EdgeIt(graph) { 33 while ( ( n & 1) &&n != -1) {34 while ( (EdgeIt::n & 1) && EdgeIt::n != -1) { 34 35 EdgeIt::operator++(); 35 36 } … … 45 46 SymEdgeIt(const Graph& graph, const Edge& edge) 46 47 : EdgeIt(graph, edge) { 47 while ( ( n & 1) &&n != -1) {48 while ( (EdgeIt::n & 1) && EdgeIt::n != -1) { 48 49 EdgeIt::operator++(); 49 50 } … … 54 55 SymEdgeIt& operator++() { 55 56 EdgeIt::operator++(); 56 while ( ( n & 1) &&n != -1) {57 while ( (EdgeIt::n & 1) && EdgeIt::n != -1) { 57 58 EdgeIt::operator++(); 58 59 } … … 122 123 } 123 124 124 /**125 * The subscript operator. The map can be subscripted by the126 * actual keys of the graph.127 */128 typename MapImpl::ReferenceType operator[](const KeyType& key) {129 int id = MapImpl::getGraph()->id(key);130 return MapImpl::operator[](id >> 1);131 }132 133 /**134 * The const subscript operator. The map can be subscripted by the135 * actual keys of the graph.136 */137 typename MapImpl::ConstReferenceType operator[](const KeyType& key) const {138 int id = MapImpl::getGraph()->id(key);139 return MapImpl::operator[](id >> 1);140 }141 142 /** Setter function of the map. Equivalent with map[key] = val.143 * This is a compatibility feature with the not dereferable maps.144 */145 void set(const KeyType& key, const typename MapImpl::ValueType& val) {146 int id = MapImpl::getGraph()->id(key);147 MapImpl::operator[](id >> 1) = val;148 }149 150 125 /** Add a new key to the map. It called by the map registry. 151 126 */ -
src/hugo/vector_map.h
r830 r844 6 6 7 7 #include <hugo/map_iterator.h> 8 #include <hugo/map_bits.h> 8 9 9 10 ///\ingroup graphmaps … … 74 75 /** Graph and Registry initialized map constructor. 75 76 */ 76 VectorMap(const Graph& g, MapRegistry& r) : MapBase(g, r) { 77 init(); 78 } 77 VectorMap(const Graph& g, MapRegistry& r) 78 : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1) {} 79 79 80 80 /** Constructor to use default value to initialize the map. 81 81 */ 82 82 VectorMap(const Graph& g, MapRegistry& r, const Value& v) 83 : MapBase(g, r) { 84 for (KeyIt it(*getGraph()); it != INVALID; ++it) { 85 int id = getGraph()->id(it); 86 if (id >= (int)container.size()) { 87 container.resize(id + 1); 88 } 89 set(it, v); 90 } 91 } 83 : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1, v) {} 92 84 93 85 /** Constructor to copy a map of an other map type. 94 86 */ 95 87 template <typename CMap> VectorMap(const CMap& copy) : MapBase(copy) { 96 if (getGraph()) { 97 for (KeyIt it(*getGraph()); it != INVALID; ++it) { 98 int id = getGraph()->id(it); 99 if (id >= (int)container.size()) { 100 container.resize(id + 1); 101 } 88 if (MapBase::getGraph()) { 89 container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1); 90 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 102 91 set(it, copy[it]); 103 92 } … … 108 97 */ 109 98 template <typename CMap> VectorMap& operator=(const CMap& copy) { 110 if (getGraph()) { 111 destroy(); 112 } 99 container.clear(); 113 100 this->MapBase::operator=(copy); 114 if (getGraph()) { 115 for (KeyIt it(*getGraph()); it != INVALID; ++it) { 116 int id = getGraph()->id(it); 117 if (id >= (int)container.size()) { 118 container.resize(id + 1); 119 } 101 if (MapBase::getGraph()) { 102 container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1); 103 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 120 104 set(it, copy[it]); 121 105 } … … 134 118 */ 135 119 ReferenceType operator[](const KeyType& key) { 136 int id = getGraph()->id(key);120 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key); 137 121 return container[id]; 138 122 } … … 143 127 */ 144 128 ConstReferenceType operator[](const KeyType& key) const { 145 int id = getGraph()->id(key);129 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key); 146 130 return container[id]; 147 131 } … … 151 135 */ 152 136 void set(const KeyType& key, const ValueType& val) { 153 int id = getGraph()->id(key);137 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key); 154 138 container[id] = val; 155 139 } … … 158 142 */ 159 143 void add(const KeyType& key) { 160 int id = getGraph()->id(key);144 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key); 161 145 if (id >= (int)container.size()) { 162 146 container.resize(id + 1); … … 232 216 Container container; 233 217 234 218 public: 219 // STL compatibility typedefs. 220 typedef Iterator iterator; 221 typedef ConstIterator const_iterator; 222 typedef typename Iterator::PairValueType value_type; 223 typedef typename Iterator::KeyType key_type; 224 typedef typename Iterator::ValueType data_type; 225 typedef typename Iterator::PairReferenceType reference; 226 typedef typename Iterator::PairPointerType pointer; 227 typedef typename ConstIterator::PairReferenceType const_reference; 228 typedef typename ConstIterator::PairPointerType const_pointer; 229 typedef int difference_type; 235 230 }; 236 231 -
src/test/test_tools.h
r825 r844 1 // -*- c++ -*- 1 2 #ifndef HUGO_TEST_TEST_TOOLS_H 2 3 #define HUGO_TEST_TEST_TOOLS_H
Note: See TracChangeset
for help on using the changeset viewer.