From a8fdd58e31c27a2de9649a1bf29389f4f3e4cb7c Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sun, 30 Sep 2012 16:23:24 +0200 Subject: [PATCH] added mixed-type operators to Vector template --- src/geometry/Vector.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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) { -- 2.39.2