summaryrefslogtreecommitdiff
path: root/src/lib/position.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/position.h')
-rw-r--r--src/lib/position.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/position.h b/src/lib/position.h
index f9bd0987c..345f7ab4a 100644
--- a/src/lib/position.h
+++ b/src/lib/position.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
#define DCPOMATIC_POSITION_H
/** @struct Position
- * @brief A position.
+ * @brief A position (x and y coordinates)
*/
template <class T>
class Position
@@ -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