diff -r 89d97db9c927 -r 625de6f1e766 src/work/deba/vector_map_factory.h --- a/src/work/deba/vector_map_factory.h Tue Jul 06 13:57:01 2004 +0000 +++ b/src/work/deba/vector_map_factory.h Fri Jul 09 07:33:12 2004 +0000 @@ -3,25 +3,25 @@ #include -#include "map_registry.h" - namespace hugo { template - class VectorMapFactory { - public: + class VectorMapFactory { + public: typedef typename MapRegistry::Graph Graph; typedef typename MapRegistry::Key Key; typedef typename MapRegistry::KeyIt KeyIt; typedef typename MapRegistry::MapBase MapBase; + template class Map : public MapBase { public: typedef V Value; + typedef std::vector Container; Map() {} Map(Graph& g, MapRegistry& r) : MapBase(g, r) { @@ -34,21 +34,16 @@ } - Value& operator[](const Key& key) { + typename Container::reference operator[](const Key& key) { int id = graph->id(key); return container[id]; } - const Value& operator[](const Key& key) const { + typename Container::const_reference operator[](const Key& key) const { int id = graph->id(key); return container[id]; } - const Value& get(const Key& key) const { - int id = graph->id(key); - return container[id]; - } - void set(const Key& key, const Value& val) { int id = graph->id(key); container[id] = val; @@ -63,11 +58,37 @@ void erase(const Key& key) {} + class const_iterator { + + private: + + }; + + class iterator { + public: + iterator() {} + + std::pair operator*() { + return std::pair(static_cast(it), map[it]); + } + + iterator& operator++() { ++it; return *this; } + iterator operator++(int) { iterator tmp(it); ++it; return tmp; } + private: + Map& map; + KeyIt it; + }; + private: typedef std::vector Container; Container container; + + }; + + + }; }