Changeset 367:825647d4eca7 in lemon-0.x for src/work/klao
- Timestamp:
- 04/21/04 21:52:09 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@495
- Location:
- src/work/klao
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/klao/iter_map.h
r365 r367 15 15 namespace hugo { 16 16 17 /// \brief A map with "small integers" as value set which can enumarate it 18 /// value classes 17 19 18 20 /// \todo Decide whether we need all the range checkings!!! 21 22 /// \todo Implement dynamic map behaviour. Is it necessary? Yes it is. 19 23 20 24 template<typename KeyIntMap, uint8_t N, typename Val = uint8_t> … … 85 89 size_t a = base[k]; 86 90 if(a < bounds[N-1]) { 87 base.set(k, move(a, find(a), n));91 move(a, find(a), n); 88 92 } 89 93 else { … … 95 99 data.push_back(k); 96 100 base.set(k, move(bounds[N-1]++, N-1, n)); 101 } 102 103 /// This func is not very usable, but necessary to implement 104 /// dynamic map behaviour. 105 void remove(const KeyType& k) { 106 size_t a = base[k]; 107 if(a < bounds[N-1]) { 108 move(a, find(a), N); 109 data.pop_back(); 110 base.set(k, -1); 111 } 97 112 } 98 113 -
src/work/klao/iter_map_test.cc
r366 r367 226 226 } 227 227 cout << endl; 228 229 cout << "Removing 10 from the map...\n"; 230 test.remove(10); 231 print(test,2); 228 232 } 229 233 }
Note: See TracChangeset
for help on using the changeset viewer.