+
+template<class T>
+inline Vector<T> operator +(const Vector<T> &lhs, const Vector<T> &rhs) {
+ return Vector<T>(lhs.X() + rhs.X(), lhs.Y() + rhs.Y());
+}
+
+template<class T>
+inline Vector<T> &operator +=(Vector<T> &lhs, const Vector<T> &rhs) {
+ return lhs = lhs + rhs;
+}
+
+template<class T>
+inline Vector<T> operator -(const Vector<T> &lhs, const Vector<T> &rhs) {
+ return Vector<T>(lhs.X() - rhs.X(), lhs.Y() - rhs.Y());
+}
+
+template<class T>
+inline Vector<T> &operator -=(Vector<T> &lhs, const Vector<T> &rhs) {
+ return lhs = lhs - rhs;
+}
+
+template<class T>
+inline Vector<T> operator -(const Vector<T> &v) {
+ return Vector<T>(-v.X(), -v.Y());
+}
+
+template<class T>
+inline Vector<T> operator *(const Vector<T> &v, T s) {
+ return Vector<T>(v.X() * s, v.Y() * s);
+}
+template<class T>
+inline Vector<T> operator *(T s, const Vector<T> &v) {
+ return Vector<T>(s * v.X(), s * v.Y());
+}
+
+template<class T>
+inline Vector<T> operator /(const Vector<T> &v, T s) {
+ return Vector<T>(v.X() / s, v.Y() / s);
+}
+
+template<class T>
+inline std::ostream &operator <<(std::ostream &out, const Vector<T> &v) {
+ out << '<' << v.X() << ", " << v.Y() << '>';
+ return out;
+}
+