Browse Source

Math: return proper type from Dual operators in subclasses.

pull/7/head
Vladimír Vondruš 13 years ago
parent
commit
2a25c6eafd
  1. 27
      src/Math/Dual.h

27
src/Math/Dual.h

@ -155,6 +155,33 @@ template<class T> class Dual {
T _real, _dual;
};
#ifndef DOXYGEN_GENERATING_OUTPUT
#define MAGNUM_DUAL_SUBCLASS_IMPLEMENTATION(Type, Underlying) \
inline Type<T> operator-() const { \
return Dual<Underlying<T>>::operator-(); \
} \
inline Type<T>& operator+=(const Dual<Underlying<T>>& other) { \
Dual<Underlying<T>>::operator+=(other); \
return *this; \
} \
inline Type<T> operator+(const Dual<Underlying<T>>& other) const { \
return Dual<Underlying<T>>::operator+(other); \
} \
inline Type<T>& operator-=(const Dual<Underlying<T>>& other) { \
Dual<Underlying<T>>::operator-=(other); \
return *this; \
} \
inline Type<T> operator-(const Dual<Underlying<T>>& other) const { \
return Dual<Underlying<T>>::operator-(other); \
} \
inline Type<T> operator*(const Dual<Underlying<T>>& other) const { \
return Dual<Underlying<T>>::operator*(other); \
} \
template<class U> inline Type<T> operator/(const Dual<U>& other) const { \
return Dual<Underlying<T>>::operator/(other); \
}
#endif
/** @debugoperator{Magnum::Math::Dual} */
template<class T> Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Dual<T>& value) {
debug << "Dual(";

Loading…
Cancel
Save