deba@340: #ifndef VECTOR_MAP_H deba@340: #define VECTOR_MAP_H deba@340: deba@340: #include deba@340: deba@340: template class MapBase > deba@340: class VectorMap : public MapBase { deba@340: public: deba@340: typedef V ValueType; deba@340: deba@340: VectorMap() {} deba@340: VectorMap(G& g) : MapBase(g) { deba@340: init(); deba@340: } deba@340: deba@340: ~VectorMap() { deba@340: // destroy(); deba@340: } deba@340: deba@340: ValueType& operator[](const K& key) { deba@340: return container[key->id]; deba@340: } deba@340: deba@340: const ValueType& operator[](const K& key) const { deba@340: return container[key->id]; deba@340: } deba@340: deba@340: const ValueType& get(const K& key) const { deba@340: return container[key->id]; deba@340: } deba@340: deba@340: void set(const K& key, const ValueType& val) { deba@340: container[key->id] = val; deba@340: } deba@340: deba@340: void add(const K& key) { deba@340: container.resize(key->id); deba@340: } deba@340: deba@340: void erase(const K& key) {} deba@340: deba@340: private: deba@340: typedef std::vector Container; deba@340: deba@340: Container container; deba@340: } deba@340: deba@340: #endif