From 793977c09139df30b3dcab7260ebd1f943084092 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 28 Jan 2012 14:59:15 +0100 Subject: Fixed vector addition and subtraction. --- vector.cpp | 12 ++++++------ vector.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/vector.cpp b/vector.cpp index 6c71991..3ab3e34 100644 --- a/vector.cpp +++ b/vector.cpp @@ -26,7 +26,7 @@ Vector2& Vector2::operator+=(const Vector2& v) { return *this; } -Vector2& Vector2::operator+(const Vector2& v) { +Vector2 Vector2::operator+(const Vector2& v) { return Vector2(*this) += v; } @@ -36,7 +36,7 @@ Vector2& Vector2::operator-=(const Vector2& v) { return *this; } -Vector2& Vector2::operator-(const Vector2& v) { +Vector2 Vector2::operator-(const Vector2& v) { return Vector2(*this) -= v; } @@ -70,7 +70,7 @@ Vector3& Vector3::operator+=(const Vector3& v) { return *this; } -Vector3& Vector3::operator+(const Vector3& v) { +Vector3 Vector3::operator+(const Vector3& v) { return Vector3(*this) += v; } @@ -81,7 +81,7 @@ Vector3& Vector3::operator-=(const Vector3& v) { return *this; } -Vector3& Vector3::operator-(const Vector3& v) { +Vector3 Vector3::operator-(const Vector3& v) { return Vector3(*this) -= v; } @@ -116,7 +116,7 @@ Vector4& Vector4::operator+=(const Vector4& v) { return *this; } -Vector4& Vector4::operator+(const Vector4& v) { +Vector4 Vector4::operator+(const Vector4& v) { return Vector4(*this) += v; } @@ -128,6 +128,6 @@ Vector4& Vector4::operator-=(const Vector4& v) { return *this; } -Vector4& Vector4::operator-(const Vector4& v) { +Vector4 Vector4::operator-(const Vector4& v) { return Vector4(*this) -= v; } diff --git a/vector.h b/vector.h index 8d85684..a74fe8c 100644 --- a/vector.h +++ b/vector.h @@ -16,9 +16,9 @@ class Vector2 { Vector2& operator=(const Vector2& v); Vector2& operator+=(const Vector2& v); - Vector2& operator+(const Vector2& v); + Vector2 operator+(const Vector2& v); Vector2& operator-=(const Vector2& v); - Vector2& operator-(const Vector2& v); + Vector2 operator-(const Vector2& v); }; class Vector3 : public Vector2 { @@ -33,9 +33,9 @@ class Vector3 : public Vector2 { Vector3& operator=(const Vector3& v); Vector3& operator+=(const Vector3& v); - Vector3& operator+(const Vector3& v); + Vector3 operator+(const Vector3& v); Vector3& operator-=(const Vector3& v); - Vector3& operator-(const Vector3& v); + Vector3 operator-(const Vector3& v); }; class Vector4 : public Vector3 { @@ -50,9 +50,9 @@ class Vector4 : public Vector3 { Vector4& operator=(const Vector4& v); Vector4& operator+=(const Vector4& v); - Vector4& operator+(const Vector4& v); + Vector4 operator+(const Vector4& v); Vector4& operator-=(const Vector4& v); - Vector4& operator-(const Vector4& v); + Vector4 operator-(const Vector4& v); }; #endif -- cgit v1.2.3