Changeset 786:d7b3b13b9df6 in lemon-0.x for src/hugo/array_map_factory.h
- Timestamp:
- 09/02/04 17:21:13 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1079
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/array_map_factory.h
r785 r786 23 23 24 24 typedef typename MapRegistry::Graph Graph; 25 typedef typename MapRegistry::Key Key;25 typedef typename MapRegistry::KeyType KeyType; 26 26 typedef typename MapRegistry::KeyIt KeyIt; 27 27 … … 114 114 115 115 116 Value& operator[](const Key & key) {116 Value& operator[](const KeyType& key) { 117 117 int id = MapBase::getGraph()->id(key); 118 118 return values[id]; 119 119 } 120 120 121 const Value& operator[](const Key & key) const {121 const Value& operator[](const KeyType& key) const { 122 122 int id = MapBase::getGraph()->id(key); 123 123 return values[id]; 124 124 } 125 125 126 const Value& get(const Key & key) const {126 const Value& get(const KeyType& key) const { 127 127 int id = MapBase::getGraph()->id(key); 128 128 return values[id]; 129 129 } 130 130 131 void set(const Key & key, const Value& val) {131 void set(const KeyType& key, const Value& val) { 132 132 int id = MapBase::getGraph()->id(key); 133 133 values[id] = val; 134 134 } 135 135 136 void add(const Key & key) {136 void add(const KeyType& key) { 137 137 int id = MapBase::getGraph()->id(key); 138 138 if (id >= capacity) { … … 156 156 } 157 157 158 void erase(const Key & key) {158 void erase(const KeyType& key) { 159 159 int id = MapBase::getGraph()->id(key); 160 160 allocator.destroy(&(values[id])); … … 185 185 iterator() {} 186 186 187 typedef extended_pair<const Key &, const Key&,187 typedef extended_pair<const KeyType&, const KeyType&, 188 188 Value&, Value&> Reference; 189 189 … … 198 198 private: 199 199 Reference data; 200 Pointer(const Key & key, Value& val) : data(key, val) {}200 Pointer(const KeyType& key, Value& val) : data(key, val) {} 201 201 public: 202 202 Reference* operator->() {return &data;} … … 275 275 const_iterator(iterator p_it) : map(p_it.map), it(p_it.it) {} 276 276 277 typedef extended_pair<const Key &, const Key&,277 typedef extended_pair<const KeyType&, const KeyType&, 278 278 const Value&, const Value&> Reference; 279 279 … … 289 289 private: 290 290 Reference data; 291 Pointer(const Key & key, const Value& val) : data(key, val) {}291 Pointer(const KeyType& key, const Value& val) : data(key, val) {} 292 292 public: 293 293 Reference* operator->() {return &data;}
Note: See TracChangeset
for help on using the changeset viewer.