From: Daniel Karbach Date: Sun, 30 Sep 2012 18:13:29 +0000 (+0200) Subject: added comparison operators to vector template X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=64c0880d31cddc599b30331f9485d65eeaf705ee;p=l2e.git added comparison operators to vector template --- diff --git a/src/geometry/Vector.h b/src/geometry/Vector.h index 562648b..7c698ff 100644 --- a/src/geometry/Vector.h +++ b/src/geometry/Vector.h @@ -88,6 +88,16 @@ inline Vector operator /(const Vector &v, T s) { return Vector(v.X() / s, v.Y() / s); } +template +inline bool operator ==(const Vector &lhs, const Vector &rhs) { + return lhs.X() == rhs.X() && lhs.Y() == rhs.Y(); +} + +template +inline bool operator !=(const Vector &lhs, const Vector &rhs) { + return lhs.X() != rhs.X() || lhs.Y() != rhs.Y(); +} + template inline std::ostream &operator <<(std::ostream &out, const Vector &v) { out << '<' << v.X() << ", " << v.Y() << '>';