aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/DenseCoeffsBase.h
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-11-02 10:11:22 +0100
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-11-02 10:11:22 +0100
commitb3007db131c0362354a35b34d376b1fc799aa534 (patch)
treee91a0a40bc3ebbf3d37f417e9a7330e66b0dcab5 /Eigen/src/Core/DenseCoeffsBase.h
parent96e4a4b59c3bdcefa324eb35891411cc64745fae (diff)
Added a comment on why is_arithmetic is used in DenseCoeffsBase.
Diffstat (limited to 'Eigen/src/Core/DenseCoeffsBase.h')
-rw-r--r--Eigen/src/Core/DenseCoeffsBase.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/Eigen/src/Core/DenseCoeffsBase.h b/Eigen/src/Core/DenseCoeffsBase.h
index b4dbe1d95..62490fb35 100644
--- a/Eigen/src/Core/DenseCoeffsBase.h
+++ b/Eigen/src/Core/DenseCoeffsBase.h
@@ -45,10 +45,13 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
typedef typename internal::traits<Derived>::Scalar Scalar;
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
- // explanation for this CoeffReturnType typedef.
- // this is the return type of the coeff() method.
- // The LvalueBit means exactly that we can offer a coeffRef() method, which means exactly that we can get references
+ // Explanation for this CoeffReturnType typedef.
+ // - This is the return type of the coeff() method.
+ // - The LvalueBit means exactly that we can offer a coeffRef() method, which means exactly that we can get references
// to coeffs, which means exactly that we can have coeff() return a const reference (as opposed to returning a value).
+ // - The is_artihmetic check is required since "const int", "const double", etc. will cause warnings on some systems
+ // while the declaration of "const T", where T is a non arithmetic type does not. Always returning "const Scalar&" is
+ // not possible, since the underlying expressions might not offer a valid address the reference could be referring to.
typedef typename internal::conditional<bool(internal::traits<Derived>::Flags&LvalueBit),
const Scalar&,
typename internal::conditional<internal::is_arithmetic<Scalar>::value, Scalar, const Scalar>::type