mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Disable AutoDiffScalar generic copy ctor for non compatible scalar types (fix ambiguous template instantiation)
This commit is contained in:
parent
92655e7215
commit
35d8725c73
14
unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
Normal file → Executable file
14
unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
Normal file → Executable file
@ -99,7 +99,11 @@ class AutoDiffScalar
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
template<typename OtherDerType>
|
template<typename OtherDerType>
|
||||||
AutoDiffScalar(const AutoDiffScalar<OtherDerType>& other)
|
AutoDiffScalar(const AutoDiffScalar<OtherDerType>& other
|
||||||
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
|
, typename internal::enable_if<internal::is_same<Scalar,typename OtherDerType::Scalar>::value,void*>::type = 0
|
||||||
|
#endif
|
||||||
|
)
|
||||||
: m_value(other.value()), m_derivatives(other.derivatives())
|
: m_value(other.value()), m_derivatives(other.derivatives())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -127,6 +131,14 @@ class AutoDiffScalar
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline AutoDiffScalar& operator=(const Scalar& other)
|
||||||
|
{
|
||||||
|
m_value = other;
|
||||||
|
if(m_derivatives.size()>0)
|
||||||
|
m_derivatives.setZero();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// inline operator const Scalar& () const { return m_value; }
|
// inline operator const Scalar& () const { return m_value; }
|
||||||
// inline operator Scalar& () { return m_value; }
|
// inline operator Scalar& () { return m_value; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user