diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index 7a3d88c38..19b0fbc9d 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h @@ -411,6 +411,7 @@ struct evaluator > : evaluator_base > { typedef SparseVector<_Scalar,_Options,_Index> SparseVectorType; + typedef evaluator_base Base; typedef typename SparseVectorType::InnerIterator InnerIterator; typedef typename SparseVectorType::ReverseInnerIterator ReverseInnerIterator; @@ -418,20 +419,22 @@ struct evaluator > CoeffReadCost = NumTraits<_Scalar>::ReadCost, Flags = SparseVectorType::Flags }; + + evaluator() : Base() {} - explicit evaluator(const SparseVectorType &mat) : m_matrix(mat) + explicit evaluator(const SparseVectorType &mat) : m_matrix(&mat) { EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); } inline Index nonZerosEstimate() const { - return m_matrix.nonZeros(); + return m_matrix->nonZeros(); } - operator SparseVectorType&() { return m_matrix.const_cast_derived(); } - operator const SparseVectorType&() const { return m_matrix; } + operator SparseVectorType&() { return m_matrix->const_cast_derived(); } + operator const SparseVectorType&() const { return *m_matrix; } - const SparseVectorType &m_matrix; + const SparseVectorType *m_matrix; }; template< typename Dest, typename Src>