diff -r be6fe0ea99b5 -r 825647d4eca7 src/work/klao/iter_map.h --- a/src/work/klao/iter_map.h Wed Apr 21 19:10:59 2004 +0000 +++ b/src/work/klao/iter_map.h Wed Apr 21 19:52:09 2004 +0000 @@ -14,9 +14,13 @@ namespace hugo { + /// \brief A map with "small integers" as value set which can enumarate it + /// value classes /// \todo Decide whether we need all the range checkings!!! + /// \todo Implement dynamic map behaviour. Is it necessary? Yes it is. + template class IterableMap { public: @@ -84,7 +88,7 @@ // FIXME: range check? size_t a = base[k]; if(a < bounds[N-1]) { - base.set(k, move(a, find(a), n)); + move(a, find(a), n); } else { insert(k, n); @@ -96,6 +100,17 @@ base.set(k, move(bounds[N-1]++, N-1, n)); } + /// This func is not very usable, but necessary to implement + /// dynamic map behaviour. + void remove(const KeyType& k) { + size_t a = base[k]; + if(a < bounds[N-1]) { + move(a, find(a), N); + data.pop_back(); + base.set(k, -1); + } + } + iterator begin(Val n) const { return data.begin() + (n ? bounds[n-1] : 0); }