aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/src/AutoDiff
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-12-16 10:14:24 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-12-16 10:14:24 +0100
commit35d8725c73cfcce45ebb774e25e51bd5ab5e61b7 (patch)
tree7478cf527fcdccfc8efb975f5227f68cbf1f44af /unsupported/Eigen/src/AutoDiff
parent92655e7215b652d09770a70877873383aceaeded (diff)
Disable AutoDiffScalar generic copy ctor for non compatible scalar types (fix ambiguous template instantiation)
Diffstat (limited to 'unsupported/Eigen/src/AutoDiff')
-rwxr-xr-x[-rw-r--r--]unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
index 8b58b512b..e30ad5b6d 100644..100755
--- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
+++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
@@ -99,7 +99,11 @@ class AutoDiffScalar
{}
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())
{}
@@ -127,6 +131,14 @@ class AutoDiffScalar
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 Scalar& () { return m_value; }