// -*- c++ -*- // #ifndef HUGO_ITER_MAP #define HUGO_ITER_MAP #include #include // for uint8_t #include // for memset #include namespace hugo { /// \todo Decide whether we need all the range checkings!!! template class IterableMap { public: typedef typename KeyIntMap::KeyType KeyType; typedef uint8_t ValueType; typedef typename std::vector::const_iterator iterator; protected: KeyIntMap &base; std::vector data; size_t bounds[N]; uint8_t find(size_t a) const { uint8_t n=0; for(; n n) { --m; half_swap(a, bounds[m]++); } while(m < n) { half_swap(a, --bounds[m]); ++m; } if(a != orig_a) { base.set(orig_key, a); data[a]=orig_key; } } return a; } public: IterableMap(KeyIntMap &_base) : base(_base) { memset(bounds, 0, sizeof(bounds)); // for(int i=0; i