Changeset 595:e10b5e9419ef in lemon-0.x for src/work/deba/vector_map_factory.h
- Timestamp:
- 05/10/04 15:49:35 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@775
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/deba/vector_map_factory.h
r571 r595 3 3 4 4 #include <vector> 5 #include <iostream>6 5 7 6 #include "map_base.h" … … 20 19 21 20 template <typename V> 22 class VectorMap : public MapBase<G, K, KIt> {21 class Map : public MapBase<G, K, KIt> { 23 22 public: 24 typedef V Value Type;23 typedef V Value; 25 24 26 VectorMap() {}25 Map() {} 27 26 28 VectorMap(Graph& g, MapRegistry<G, K, KIt>& r) 29 : MapBase<G, K, KIt>(g, r) {} 27 Map(Graph& g, MapRegistry<G, K, KIt>& r) 28 : MapBase<G, K, KIt>(g, r) { 29 init(); 30 } 31 32 virtual ~Map() { 33 destroy(); 34 } 30 35 31 36 32 Value Type& operator[](const K& key) {37 Value& operator[](const K& key) { 33 38 int id = graph->id(key); 34 39 return container[id]; 35 40 } 36 41 37 const Value Type& operator[](const K& key) const {42 const Value& operator[](const K& key) const { 38 43 int id = graph->id(key); 39 44 return container[id]; 40 45 } 41 46 42 const Value Type& get(const K& key) const {47 const Value& get(const K& key) const { 43 48 int id = graph->id(key); 44 49 return container[id]; 45 50 } 46 51 47 void set(const K& key, const Value Type& val) {52 void set(const K& key, const Value& val) { 48 53 int id = graph->id(key); 49 54 container[id] = val; … … 52 57 void add(const K& key) { 53 58 int id = graph->id(key); 54 std::cerr << id << std::endl;55 59 if (id >= container.size()) { 56 60 container.resize(id + 1); … … 61 65 62 66 private: 63 typedef std::vector<Value Type> Container;67 typedef std::vector<Value> Container; 64 68 65 69 Container container;
Note: See TracChangeset
for help on using the changeset viewer.