# HG changeset patch # User alpar # Date 1111738903 0 # Node ID 7101e2c3a881d9e0a34f5842054d17c22750973f # Parent 3bb4ed285c39b8650c69fe1d7758cb09105bbc85 - several missing 'const' added - value of xy is undefined by default diff -r 3bb4ed285c39 -r 7101e2c3a881 src/lemon/xy.h --- a/src/lemon/xy.h Fri Mar 25 08:18:27 2005 +0000 +++ b/src/lemon/xy.h Fri Mar 25 08:21:43 2005 +0000 @@ -38,9 +38,9 @@ /// \addtogroup misc /// @{ - /// A two dimensional vector (plainvector) implementation + /// A simple two dimensional vector (plainvector) implementation - /// A two dimensional vector (plainvector) implementation + /// A simple two dimensional vector (plainvector) implementation ///with the usual vector /// operators. /// @@ -54,8 +54,8 @@ T x,y; - ///Default constructor: both coordinates become 0 - xy() : x(0), y(0) {} + ///Default constructor + xy() {} ///Constructing the instance from coordinates xy(T a, T b) : x(a), y(b) { } @@ -65,40 +65,40 @@ template xy(const xy &p) : x(p.x), y(p.y) {} ///Gives back the square of the norm of the vector - T normSquare(){ + T normSquare() const { return x*x+y*y; }; ///Increments the left hand side by u - xy& operator +=(const xy& u){ + xy& operator +=(const xy& u) { x += u.x; y += u.y; return *this; }; ///Decrements the left hand side by u - xy& operator -=(const xy& u){ + xy& operator -=(const xy& u) { x -= u.x; y -= u.y; return *this; }; ///Multiplying the left hand side with a scalar - xy& operator *=(const T &u){ + xy& operator *=(const T &u) { x *= u; y *= u; return *this; }; ///Dividing the left hand side by a scalar - xy& operator /=(const T &u){ + xy& operator /=(const T &u) { x /= u; y /= u; return *this; }; ///Returns the scalar product of two vectors - T operator *(const xy& u){ + T operator *(const xy& u) const { return x*u.x+y*u.y; }; @@ -134,12 +134,12 @@ }; ///Testing equality - bool operator==(const xy &u){ + bool operator==(const xy &u) const { return (x==u.x) && (y==u.y); }; ///Testing inequality - bool operator!=(xy u){ + bool operator!=(xy u) const { return (x!=u.x) || (y!=u.y); };