diff -r 77ed2b97abbd -r 02fedd6652c6 lemon/maps.h --- a/lemon/maps.h Thu Apr 19 15:07:03 2007 +0000 +++ b/lemon/maps.h Thu Apr 19 15:09:08 2007 +0000 @@ -1044,21 +1044,35 @@ inline NotMap notMap(const M &m) { return NotMap(m); } - + template inline NotWriteMap notMap(M &m) { return NotWriteMap(m); } namespace _maps_bits { + template struct Identity { typedef Value argument_type; typedef Value result_type; - Value operator()(const Value& val) { + Value operator()(const Value& val) const { return val; } }; + + template + struct IteratorTraits { + typedef typename std::iterator_traits<_Iterator>::value_type Value; + }; + + template + struct IteratorTraits<_Iterator, + typename exists::type> + { + typedef typename _Iterator::container_type::value_type Value; + }; + } @@ -1085,8 +1099,9 @@ /// prim(ugraph, cost, writerMap); ///\endcode template ::value_type> > + typename _Functor = + _maps_bits::Identity::Value> > class StoreBoolMap { public: typedef _Iterator Iterator; @@ -1111,14 +1126,15 @@ } /// Setter function of the map - void set(const Key& key, Value value) { + void set(const Key& key, Value value) const { if (value) { *_end++ = _functor(key); } } private: - Iterator _begin, _end; + Iterator _begin; + mutable Iterator _end; Functor _functor; };