From b3007db131c0362354a35b34d376b1fc799aa534 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Tue, 2 Nov 2010 10:11:22 +0100 Subject: Added a comment on why is_arithmetic is used in DenseCoeffsBase. --- Eigen/src/Core/DenseCoeffsBase.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Eigen/src/Core/DenseCoeffsBase.h') 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 : public EigenBase typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::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::Flags&LvalueBit), const Scalar&, typename internal::conditional::value, Scalar, const Scalar>::type -- cgit v1.2.3