Fix in contracted operators.

This commit is contained in:
King_DuckZ 2014-02-22 13:12:50 +01:00
parent 239a1c88d8
commit 3269b469e3
2 changed files with 12 additions and 20 deletions

View file

@ -49,13 +49,13 @@ namespace cloonel {
}; };
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>
Vector<typename std::common_type<T, U>::type, S> operator+ ( const Vector<T, S>& parA, const Vector<U, S>& parB ) __attribute__((pure)); Vector<typename std::common_type<T, U>::type, S> operator+ ( Vector<T, S> parA, const Vector<U, S>& parB ) __attribute__((pure));
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>
Vector<typename std::common_type<T, U>::type, S> operator- ( const Vector<T, S>& parA, const Vector<U, S>& parB ) __attribute__((pure)); Vector<typename std::common_type<T, U>::type, S> operator- ( Vector<T, S> parA, const Vector<U, S>& parB ) __attribute__((pure));
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>
Vector<typename std::common_type<T, U>::type, S> operator* ( const Vector<T, S>& parA, const Vector<U, S>& parB ) __attribute__((pure)); Vector<typename std::common_type<T, U>::type, S> operator* ( Vector<T, S> parA, const Vector<U, S>& parB ) __attribute__((pure));
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>
Vector<typename std::common_type<T, U>::type, S> operator/ ( const Vector<T, S>& parA, const Vector<U, S>& parB ) __attribute__((pure)); Vector<typename std::common_type<T, U>::type, S> operator/ ( Vector<T, S> parA, const Vector<U, S>& parB ) __attribute__((pure));
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>
Vector<typename std::common_type<T, U>::type, S> operator+ ( U parA, const Vector<U, S>& parB ) __attribute__((pure)); Vector<typename std::common_type<T, U>::type, S> operator+ ( U parA, const Vector<U, S>& parB ) __attribute__((pure));
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>

View file

@ -91,35 +91,27 @@ namespace cloonel {
///------------------------------------------------------------------------- ///-------------------------------------------------------------------------
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>
inline inline
Vector<typename std::common_type<T, U>::type, S> operator+ (const Vector<T, S>& parA, const Vector<U, S>& parB) { Vector<typename std::common_type<T, U>::type, S> operator+ (Vector<T, S> parA, const Vector<U, S>& parB) {
typedef typename std::common_type<T, U>::type RetType;
Vector<RetType, S> retVal(parA);
parA += parB; parA += parB;
return retVal; return parA;
} }
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>
inline inline
Vector<typename std::common_type<T, U>::type, S> operator- (const Vector<T, S>& parA, const Vector<U, S>& parB) { Vector<typename std::common_type<T, U>::type, S> operator- (Vector<T, S> parA, const Vector<U, S>& parB) {
typedef typename std::common_type<T, U>::type RetType;
Vector<RetType, S> retVal(parA);
parA -= parB; parA -= parB;
return retVal; return parA;
} }
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>
inline inline
Vector<typename std::common_type<T, U>::type, S> operator* (const Vector<T, S>& parA, const Vector<U, S>& parB) { Vector<typename std::common_type<T, U>::type, S> operator* (Vector<T, S> parA, const Vector<U, S>& parB) {
typedef typename std::common_type<T, U>::type RetType;
Vector<RetType, S> retVal(parA);
parA *= parB; parA *= parB;
return retVal; return parA;
} }
template <typename T, typename U, uint32_t S> template <typename T, typename U, uint32_t S>
inline inline
Vector<typename std::common_type<T, U>::type, S> operator/ (const Vector<T, S>& parA, const Vector<U, S>& parB) { Vector<typename std::common_type<T, U>::type, S> operator/ (Vector<T, S> parA, const Vector<U, S>& parB) {
typedef typename std::common_type<T, U>::type RetType;
Vector<RetType, S> retVal(parA);
parA /= parB; parA /= parB;
return retVal; return parA;
} }
///------------------------------------------------------------------------- ///-------------------------------------------------------------------------