From 41b0fd733f9e1edc5e86dc8761e8d8d73bd91116 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 5 Dec 2011 14:13:59 +0100 Subject: [PATCH] fix QuaternionBase::cast. It did not work with clang, and I'm unsure how it worked for gcc/msvc since QuaternionBase was introduced (transplanted from 84cf1b5b1d6c122a3b103578ab18ac8dd5e825e6 ) --- Eigen/src/Geometry/Quaternion.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index 7d6be0799..b2f127b6a 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h @@ -182,8 +182,7 @@ public: template inline typename internal::cast_return_type >::type cast() const { - return typename internal::cast_return_type >::type( - coeffs().template cast()); + return typename internal::cast_return_type >::type(derived()); } #ifdef EIGEN_QUATERNIONBASE_PLUGIN @@ -274,6 +273,11 @@ public: template explicit inline Quaternion(const MatrixBase& other) { *this = other; } + /** Explicit copy constructor with scalar conversion */ + template + explicit inline Quaternion(const Quaternion& other) + { m_coeffs = other.coeffs().template cast(); } + inline Coefficients& coeffs() { return m_coeffs;} inline const Coefficients& coeffs() const { return m_coeffs;}