From 3269b469e3c2b643060972ad78ebf62a051b6cbf Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 22 Feb 2014 13:12:50 +0100 Subject: [PATCH] Fix in contracted operators. --- src/vector.hpp | 8 ++++---- src/vector.inl | 24 ++++++++---------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/vector.hpp b/src/vector.hpp index 87ae4f8..f095ac4 100644 --- a/src/vector.hpp +++ b/src/vector.hpp @@ -49,13 +49,13 @@ namespace cloonel { }; template - Vector::type, S> operator+ ( const Vector& parA, const Vector& parB ) __attribute__((pure)); + Vector::type, S> operator+ ( Vector parA, const Vector& parB ) __attribute__((pure)); template - Vector::type, S> operator- ( const Vector& parA, const Vector& parB ) __attribute__((pure)); + Vector::type, S> operator- ( Vector parA, const Vector& parB ) __attribute__((pure)); template - Vector::type, S> operator* ( const Vector& parA, const Vector& parB ) __attribute__((pure)); + Vector::type, S> operator* ( Vector parA, const Vector& parB ) __attribute__((pure)); template - Vector::type, S> operator/ ( const Vector& parA, const Vector& parB ) __attribute__((pure)); + Vector::type, S> operator/ ( Vector parA, const Vector& parB ) __attribute__((pure)); template Vector::type, S> operator+ ( U parA, const Vector& parB ) __attribute__((pure)); template diff --git a/src/vector.inl b/src/vector.inl index a6b010e..c6ec36c 100644 --- a/src/vector.inl +++ b/src/vector.inl @@ -91,35 +91,27 @@ namespace cloonel { ///------------------------------------------------------------------------- template inline - Vector::type, S> operator+ (const Vector& parA, const Vector& parB) { - typedef typename std::common_type::type RetType; - Vector retVal(parA); + Vector::type, S> operator+ (Vector parA, const Vector& parB) { parA += parB; - return retVal; + return parA; } template inline - Vector::type, S> operator- (const Vector& parA, const Vector& parB) { - typedef typename std::common_type::type RetType; - Vector retVal(parA); + Vector::type, S> operator- (Vector parA, const Vector& parB) { parA -= parB; - return retVal; + return parA; } template inline - Vector::type, S> operator* (const Vector& parA, const Vector& parB) { - typedef typename std::common_type::type RetType; - Vector retVal(parA); + Vector::type, S> operator* (Vector parA, const Vector& parB) { parA *= parB; - return retVal; + return parA; } template inline - Vector::type, S> operator/ (const Vector& parA, const Vector& parB) { - typedef typename std::common_type::type RetType; - Vector retVal(parA); + Vector::type, S> operator/ (Vector parA, const Vector& parB) { parA /= parB; - return retVal; + return parA; } ///-------------------------------------------------------------------------