From b8df58a5e79b3fa4273ce9ac25c33455519fedbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 16 Feb 2013 19:03:04 +0100 Subject: [PATCH] Math: Allow division of Dual with Dual of another type. Will allow dividing Dual> with Dual. --- src/Math/Dual.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Math/Dual.h b/src/Math/Dual.h index 43e3e1eca..5e3b6f884 100644 --- a/src/Math/Dual.h +++ b/src/Math/Dual.h @@ -27,6 +27,8 @@ namespace Magnum { namespace Math { /** @brief %Dual number */ template class Dual { + template friend class Dual; + public: /** * @brief Default constructor @@ -134,7 +136,7 @@ template class Dual { * \frac{\hat a}{\hat b} = \frac{a_0}{b_0} + \epsilon \frac{a_\epsilon b_0 - a_0 b_\epsilon}{b_0^2} * @f] */ - inline Dual operator/(const Dual& other) const { + template inline Dual operator/(const Dual& other) const { return {_real/other._real, (_dual*other._real - _real*other._dual)/(other._real*other._real)}; }