diff -r 269a0dcee70b -r 1ac928089d68 lemon/maps.h --- a/lemon/maps.h Tue Oct 17 10:50:57 2006 +0000 +++ b/lemon/maps.h Tue Oct 17 11:01:16 2006 +0000 @@ -287,6 +287,47 @@ return ConvertMap(m); } + ///Simple wrapping of the map + + ///This \ref concept::ReadMap "read only map" returns the simple + ///wrapping of the given map. Sometimes the reference maps cannot be + ///combined with simple read maps. This map adaptor wraps the given + ///map to simple read map. + template + class SimpleMap : public MapBase { + const M& m; + + public: + typedef MapBase Parent; + typedef typename Parent::Key Key; + typedef typename Parent::Value Value; + + ///Constructor + SimpleMap(const M &_m) : m(_m) {}; + Value operator[](Key k) const {return m[k];} + }; + + ///Simple writeable wrapping of the map + + ///This \ref concept::ReadMap "read only map" returns the simple + ///wrapping of the given map. Sometimes the reference maps cannot be + ///combined with simple read-write maps. This map adaptor wraps the + ///given map to simple read-write map. + template + class SimpleWriteMap : public MapBase { + M& m; + + public: + typedef MapBase Parent; + typedef typename Parent::Key Key; + typedef typename Parent::Value Value; + + ///Constructor + SimpleWriteMap(M &_m) : m(_m) {}; + Value operator[](Key k) const {return m[k];} + void set(Key k, const Value& c) { m.set(k, c); } + }; + ///Sum of two maps ///This \ref concept::ReadMap "read only map" returns the sum of the two