[Lemon-commits] [lemon_svn] alpar: r1443 - hugo/trunk/src/lemon

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:45:29 CET 2006


Author: alpar
Date: Tue Jan  4 23:14:42 2005
New Revision: 1443

Modified:
   hugo/trunk/src/lemon/xy.h

Log:
Conversion constructor added

Modified: hugo/trunk/src/lemon/xy.h
==============================================================================
--- hugo/trunk/src/lemon/xy.h	(original)
+++ hugo/trunk/src/lemon/xy.h	Tue Jan  4 23:14:42 2005
@@ -61,6 +61,9 @@
       xy(T a, T b) : x(a), y(b) { }
 
 
+      ///Conversion constructor
+      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(){
 	return x*x+y*y;
@@ -105,6 +108,13 @@
 	return b+=u;
       };
 
+      ///Returns the neg of the vectors
+      xy<T> operator-() const {
+	xy<T> b=*this;
+	b.x=-b.x; b.y=-b.y;
+	return b;
+      };
+
       ///Returns the difference of two vectors
       xy<T> operator-(const xy<T> &u) const {
 	xy<T> b=*this;



More information about the Lemon-commits mailing list