diff -r c03e073b8394 -r 4207f82a1778 src/work/deba/vector_map_factory.h --- a/src/work/deba/vector_map_factory.h Wed Jul 14 10:06:27 2004 +0000 +++ b/src/work/deba/vector_map_factory.h Wed Jul 14 21:16:10 2004 +0000 @@ -4,6 +4,8 @@ #include #include +#include "extended_pair.h" + namespace hugo { /** The VectorMapFactory template class is a factory class @@ -155,11 +157,21 @@ return std::pair(it, (*map)[it]); } + + class Pointer { + friend class iterator; + private: + typedef extended_pair Pair; + Pair data; + Pointer(const Key& key, Value& val) : data(key, val) {} + public: + Pair* operator->() {return &data;} + }; + /** Arrow operator for map. */ - std::pair* operator->() { - static std::pair tmp = operator*(); - return &tmp; + Pointer operator->() { + return Pointer(it, ((*map)[it])); } /** The pre increment operator of the map. @@ -188,6 +200,7 @@ bool operator!=(const_iterator p_it) { return !(*this == p_it); } + private: Map* map; @@ -234,11 +247,19 @@ return std::pair(it, (*map)[it]); } + class Pointer { + friend class const_iterator; + private: + typedef extended_pair Pair; + Pair data; + Pointer(const Key& key, const Value& val) : data(key, val) {} + public: + Pair* operator->() {return &data;} + }; /** Arrow operator for map. */ - std::pair* operator->() const { - static std::pair tmp = operator*(); - return &tmp; + Pointer operator->() const { + return Pointer(it, (*map)[it]); } /** The pre increment operator of the map. @@ -268,6 +289,7 @@ return !(*this == p_it); } + private: const Map* map; KeyIt it;