Changeset 1999:2ff283124dfc in lemon-0.x for lemon/bits/map_extender.h
- Timestamp:
- 03/06/06 11:28:37 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2609
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/map_extender.h
r1996 r1999 30 30 31 31 /// \ingroup graphbits 32 /// 33 /// \brief Extender for maps 32 34 template <typename _Map> 33 class IterableMapExtender : public _Map {35 class MapExtender : public _Map { 34 36 public: 35 37 36 38 typedef _Map Parent; 37 typedef IterableMapExtender Map;39 typedef MapExtender Map; 38 40 39 41 … … 50 52 friend class ConstMapIt; 51 53 52 protected:53 54 using Parent::getGraph;55 56 54 public: 57 55 58 IterableMapExtender(const Graph& graph) : Parent(graph) {} 56 MapExtender(const Graph& graph) 57 : Parent(graph) {} 59 58 60 IterableMapExtender(const Graph& graph, const Value& value)59 MapExtender(const Graph& graph, const Value& value) 61 60 : Parent(graph, value) {} 62 61 63 62 64 class MapIt : public Item SetTraits<Graph, Item>::ItemIt{63 class MapIt : public Item { 65 64 public: 66 65 67 typedef typename ItemSetTraits<Graph, Item>::ItemIt Parent; 68 66 typedef Item Parent; 69 67 typedef typename Map::Value Value; 70 68 71 MapIt(Map& _map) : Parent(*_map.getGraph()), map(_map) {} 69 MapIt() {} 70 71 MapIt(Invalid i) : Parent(i) { } 72 73 explicit MapIt(Map& _map) : map(_map) { 74 map.getNotifier()->first(*this); 75 } 76 77 MapIt(const Map& _map, const Item& item) 78 : Parent(item), map(_map) {} 79 80 MapIt& operator++() { 81 map.getNotifier()->next(*this); 82 return *this; 83 } 72 84 73 85 typename MapTraits<Map>::ConstReturnValue operator*() const { … … 88 100 }; 89 101 90 class ConstMapIt : public Item SetTraits<Graph, Key>::ItemIt{102 class ConstMapIt : public Item { 91 103 public: 92 104 93 typedef typename ItemSetTraits<Graph, Key>::ItemItParent;105 typedef Item Parent; 94 106 95 107 typedef typename Map::Value Value; 108 109 ConstMapIt() {} 96 110 97 ConstMapIt(const Map& _map) : Parent(*_map.getGraph()), map(_map) {} 111 ConstMapIt(Invalid i) : Parent(i) { } 112 113 explicit ConstMapIt(Map& _map) : map(_map) { 114 map.getNotifier()->first(*this); 115 } 116 117 ConstMapIt(const Map& _map, const Item& item) 118 : Parent(item), map(_map) {} 119 120 ConstMapIt& operator++() { 121 map.getNotifier()->next(*this); 122 return *this; 123 } 98 124 99 125 typename MapTraits<Map>::ConstReturnValue operator*() const { 100 126 return map[*this]; 101 127 } 128 102 129 protected: 103 130 const Map& map; 104 131 }; 105 132 106 class ItemIt : public ItemSetTraits<Graph, Key>::ItemIt{133 class ItemIt : Item { 107 134 public: 108 135 109 typedef typename ItemSetTraits<Graph, Key>::ItemIt Parent; 136 typedef Item Parent; 137 138 ItemIt() {} 110 139 111 ItemIt(Map& _map) : Parent(*_map.getGraph()) {} 140 ItemIt(Invalid i) : Parent(i) { } 141 142 explicit ItemIt(Map& _map) : map(_map) { 143 map->getNotifier()->first(*this); 144 } 145 146 ItemIt(const Map& _map, const Item& item) 147 : Parent(item), map(_map) {} 148 149 ItemIt& operator++() { 150 map.getNotifier()->next(*this); 151 return *this; 152 } 153 154 protected: 155 const Map& map; 112 156 113 157 };
Note: See TracChangeset
for help on using the changeset viewer.