[Lemon-commits] [lemon_svn] alpar: r1684 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:46:58 CET 2006
Author: alpar
Date: Fri Mar 25 09:21:43 2005
New Revision: 1684
Modified:
hugo/trunk/src/lemon/xy.h
Log:
- several missing 'const' added
- value of xy is undefined by default
Modified: hugo/trunk/src/lemon/xy.h
==============================================================================
--- hugo/trunk/src/lemon/xy.h (original)
+++ hugo/trunk/src/lemon/xy.h Fri Mar 25 09:21:43 2005
@@ -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<class TT> xy(const xy<TT> &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<T>& operator +=(const xy<T>& u){
+ xy<T>& operator +=(const xy<T>& u) {
x += u.x;
y += u.y;
return *this;
};
///Decrements the left hand side by u
- xy<T>& operator -=(const xy<T>& u){
+ xy<T>& operator -=(const xy<T>& u) {
x -= u.x;
y -= u.y;
return *this;
};
///Multiplying the left hand side with a scalar
- xy<T>& operator *=(const T &u){
+ xy<T>& operator *=(const T &u) {
x *= u;
y *= u;
return *this;
};
///Dividing the left hand side by a scalar
- xy<T>& operator /=(const T &u){
+ xy<T>& operator /=(const T &u) {
x /= u;
y /= u;
return *this;
};
///Returns the scalar product of two vectors
- T operator *(const xy<T>& u){
+ T operator *(const xy<T>& u) const {
return x*u.x+y*u.y;
};
@@ -134,12 +134,12 @@
};
///Testing equality
- bool operator==(const xy<T> &u){
+ bool operator==(const xy<T> &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);
};
More information about the Lemon-commits
mailing list