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
)
This commit is contained in:
Gael Guennebaud 2011-12-05 14:13:59 +01:00
parent 228920fad7
commit 41b0fd733f

View File

@ -182,8 +182,7 @@ public:
template<typename NewScalarType>
inline typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type cast() const
{
return typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type(
coeffs().template cast<NewScalarType>());
return typename internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type(derived());
}
#ifdef EIGEN_QUATERNIONBASE_PLUGIN
@ -274,6 +273,11 @@ public:
template<typename Derived>
explicit inline Quaternion(const MatrixBase<Derived>& other) { *this = other; }
/** Explicit copy constructor with scalar conversion */
template<typename OtherScalar, int OtherOptions>
explicit inline Quaternion(const Quaternion<OtherScalar, OtherOptions>& other)
{ m_coeffs = other.coeffs().template cast<Scalar>(); }
inline Coefficients& coeffs() { return m_coeffs;}
inline const Coefficients& coeffs() const { return m_coeffs;}