From 2a25c6eafd66278447e9d640f5fea58a34c0f758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 16 Feb 2013 19:03:52 +0100 Subject: [PATCH] Math: return proper type from Dual operators in subclasses. --- src/Math/Dual.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Math/Dual.h b/src/Math/Dual.h index 5e3b6f884..45cc4f344 100644 --- a/src/Math/Dual.h +++ b/src/Math/Dual.h @@ -155,6 +155,33 @@ template class Dual { T _real, _dual; }; +#ifndef DOXYGEN_GENERATING_OUTPUT +#define MAGNUM_DUAL_SUBCLASS_IMPLEMENTATION(Type, Underlying) \ + inline Type operator-() const { \ + return Dual>::operator-(); \ + } \ + inline Type& operator+=(const Dual>& other) { \ + Dual>::operator+=(other); \ + return *this; \ + } \ + inline Type operator+(const Dual>& other) const { \ + return Dual>::operator+(other); \ + } \ + inline Type& operator-=(const Dual>& other) { \ + Dual>::operator-=(other); \ + return *this; \ + } \ + inline Type operator-(const Dual>& other) const { \ + return Dual>::operator-(other); \ + } \ + inline Type operator*(const Dual>& other) const { \ + return Dual>::operator*(other); \ + } \ + template inline Type operator/(const Dual& other) const { \ + return Dual>::operator/(other); \ + } +#endif + /** @debugoperator{Magnum::Math::Dual} */ template Corrade::Utility::Debug operator<<(Corrade::Utility::Debug debug, const Dual& value) { debug << "Dual(";