From: Daniel Karbach Date: Sun, 30 Sep 2012 14:23:24 +0000 (+0200) Subject: added mixed-type operators to Vector template X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;ds=sidebyside;h=a8fdd58e31c27a2de9649a1bf29389f4f3e4cb7c;p=l2e.git added mixed-type operators to Vector template --- diff --git a/src/geometry/Vector.h b/src/geometry/Vector.h index bf64713..562648b 100644 --- a/src/geometry/Vector.h +++ b/src/geometry/Vector.h @@ -37,21 +37,37 @@ template inline Vector operator +(const Vector &lhs, const Vector &rhs) { return Vector(lhs.X() + rhs.X(), lhs.Y() + rhs.Y()); } +template +inline Vector operator +(const Vector &lhs, const Vector &rhs) { + return Vector(lhs.X() + rhs.X(), lhs.Y() + rhs.Y()); +} template inline Vector &operator +=(Vector &lhs, const Vector &rhs) { return lhs = lhs + rhs; } +template +inline Vector &operator +=(Vector &lhs, const Vector &rhs) { + return lhs = lhs + rhs; +} template inline Vector operator -(const Vector &lhs, const Vector &rhs) { return Vector(lhs.X() - rhs.X(), lhs.Y() - rhs.Y()); } +template +inline Vector operator -(const Vector &lhs, const Vector &rhs) { + return Vector(lhs.X() - rhs.X(), lhs.Y() - rhs.Y()); +} template inline Vector &operator -=(Vector &lhs, const Vector &rhs) { return lhs = lhs - rhs; } +template +inline Vector &operator -=(Vector &lhs, const Vector &rhs) { + return lhs = lhs - rhs; +} template inline Vector operator -(const Vector &v) {