Changeset 987:87f7c54892df in lemon-0.x for src/work/klao/iter_map.h
- Timestamp:
- 11/13/04 18:07:10 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1377
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/klao/iter_map.h
r921 r987 26 26 public: 27 27 28 typedef typename KeyIntMap::Key Type KeyType;29 typedef Val Value Type;28 typedef typename KeyIntMap::Key Key; 29 typedef Val Value; 30 30 31 typedef typename std::vector<Key Type>::const_iterator iterator;31 typedef typename std::vector<Key>::const_iterator iterator; 32 32 33 33 protected: 34 34 KeyIntMap &base; 35 std::vector<Key Type> data;35 std::vector<Key> data; 36 36 size_t bounds[N]; 37 37 Val def_val; … … 56 56 if(m != n) { 57 57 size_t orig_a = a; 58 Key Typeorig_key = data[a];58 Key orig_key = data[a]; 59 59 while(m > n) { 60 60 --m; … … 81 81 } 82 82 83 Val operator[](const Key Type& k) const {83 Val operator[](const Key& k) const { 84 84 return find(base[k]); 85 85 } 86 86 87 void set(const Key Type& k, Val n) {87 void set(const Key& k, Val n) { 88 88 // FIXME: range check? 89 89 size_t a = base[k]; … … 96 96 } 97 97 98 void insert(const Key Type& k, Val n) {98 void insert(const Key& k, Val n) { 99 99 data.push_back(k); 100 100 base.set(k, move(bounds[N-1]++, N-1, n)); … … 103 103 /// This func is not very usable, but necessary to implement 104 104 /// dynamic map behaviour. 105 void remove(const Key Type& k) {105 void remove(const Key& k) { 106 106 size_t a = base[k]; 107 107 if(a < bounds[N-1]) { … … 131 131 132 132 /// For use as an iterator... 133 Key Type& first(KeyType&k, Val n) {133 Key& first(Key &k, Val n) { 134 134 size_t i = (n ? bounds[n-1] : 0); 135 135 if( i < bounds[n] ) { … … 143 143 144 144 /// For use as an iterator... 145 Key Type& next(KeyType&k) {145 Key& next(Key &k) { 146 146 size_t i = base[k]; 147 147 uint8_t n = find(i);
Note: See TracChangeset
for help on using the changeset viewer.