diff options
author | Gael Guennebaud <g.gael@free.fr> | 2017-01-25 17:39:01 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2017-01-25 17:39:01 +0100 |
commit | 296d24be4dd3c700089d1d9182a843c60d68019c (patch) | |
tree | 36118200fe6a05bf4d19daf0f5b7130bc0f0b8ce /Eigen/src/Core/util/XprHelper.h | |
parent | d06a48959abac6369336d3873d46aee78f8fbec2 (diff) |
bug #1381: fix sparse.diagonal() used as a rvalue.
The problem was that is "sparse" is not const, then sparse.diagonal() must have the
LValueBit flag meaning that sparse.diagonal().coeff(i) must returns a const reference,
const Scalar&. However, sparse::coeff() cannot returns a reference for a non-existing
zero coefficient. The trick is to return a reference to a local member of
evaluator<SparseMatrix>.
Diffstat (limited to 'Eigen/src/Core/util/XprHelper.h')
-rw-r--r-- | Eigen/src/Core/util/XprHelper.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index b94dd61ff..d5e565cb8 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -638,7 +638,7 @@ struct plain_constant_type template<typename ExpressionType> struct is_lvalue { - enum { value = !bool(is_const<ExpressionType>::value) && + enum { value = (!bool(is_const<ExpressionType>::value)) && bool(traits<ExpressionType>::Flags & LvalueBit) }; }; |