Add some operators.
authorCarl Hetherington <cth@carlh.net>
Fri, 13 Jun 2014 11:03:02 +0000 (12:03 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 13 Jun 2014 11:03:02 +0000 (12:03 +0100)
src/lib/position.h

index d68fcb1af9a02aa6cf1a3cb0e452e5718c7f4aa2..345f7ab4a85bcd8b0cd7565543e4736f26e90968 100644 (file)
@@ -50,4 +50,18 @@ operator+ (Position<T> const & a, Position<T> const & b)
        return Position<T> (a.x + b.x, a.y + b.y);
 }
 
+template<class T>
+Position<T>
+operator- (Position<T> const & a, Position<T> const & b)
+{
+       return Position<T> (a.x - b.x, a.y - b.y);
+}
+
+template<class T>
+bool
+operator== (Position<T> const & a, Position<T> const & b)
+{
+       return a.x == b.x && a.y == b.y;
+}
+
 #endif