# HG changeset patch # User alpar # Date 1113481818 0 # Node ID bdbb9144a49e58fe0e1ddc98a9b7eabfd33c2003 # Parent 551ffd3bcbb71b0de343791353ad4aece7946368 - Bugfix in XMap/YMap - NormSquareMap added diff -r 551ffd3bcbb7 -r bdbb9144a49e src/lemon/xy.h --- a/src/lemon/xy.h Thu Apr 14 12:09:35 2005 +0000 +++ b/src/lemon/xy.h Thu Apr 14 12:30:18 2005 +0000 @@ -339,7 +339,7 @@ ///\e XMap(M &map) : _map(map) {} Value operator[](Key k) const {return _map[k].x;} - Value set(Key k,Value v) {_map.set(k,typename M::Value(v,_map[k].y));} + void set(Key k,Value v) {_map.set(k,typename M::Value(v,_map[k].y));} }; ///Returns an \ref XMap class @@ -396,7 +396,7 @@ ///\e YMap(M &map) : _map(map) {} Value operator[](Key k) const {return _map[k].y;} - Value set(Key k,Value v) {_map.set(k,typename M::Value(_map[k].x,v));} + void set(Key k,Value v) {_map.set(k,typename M::Value(_map[k].x,v));} }; ///Returns an \ref YMap class @@ -440,6 +440,35 @@ } + ///Map of the \ref xy::normSquare() "normSquare()" of an \ref xy "xy"-map + + ///Map of the \ref xy::normSquare() "normSquare()" of an \ref xy "xy"-map + ///\ingroup maps + /// + template + class NormSquareMap + { + const M &_map; + public: + typedef typename M::Value::Value Value; + typedef typename M::Key Key; + ///\e + NormSquareMap(const M &map) : _map(map) {} + Value operator[](Key k) const {return _map[k].normSquare();} + }; + + ///Returns a \ref NormSquareMap class + + ///This function just returns an \ref NormSquareMap class. + /// + ///\ingroup maps + ///\relates NormSquareMap + template + inline NormSquareMap normSquareMap(const M &m) + { + return NormSquareMap(m); + } + /// @}