From 697e1656ce970c2881f31a491226e25c4af4cbed Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 6 May 2011 21:15:05 +0200 Subject: [PATCH] add missing .data() members to MatrixWrapper and ArrayWrapper (transplanted from fb76452cbc4c62feb6c5bc47319ceefe3e54dd80 ) --- Eigen/src/Core/ArrayWrapper.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Eigen/src/Core/ArrayWrapper.h b/Eigen/src/Core/ArrayWrapper.h index 7ba01de36..07f082e1e 100644 --- a/Eigen/src/Core/ArrayWrapper.h +++ b/Eigen/src/Core/ArrayWrapper.h @@ -53,6 +53,12 @@ class ArrayWrapper : public ArrayBase > EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + typedef typename internal::nested::type NestedExpressionType; inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {} @@ -62,6 +68,9 @@ class ArrayWrapper : public ArrayBase > inline Index outerStride() const { return m_expression.outerStride(); } inline Index innerStride() const { return m_expression.innerStride(); } + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + inline const Scalar* data() const { return m_expression.data(); } + inline const CoeffReturnType coeff(Index row, Index col) const { return m_expression.coeff(row, col); @@ -151,6 +160,12 @@ class MatrixWrapper : public MatrixBase > EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper) + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + typedef typename internal::nested::type NestedExpressionType; inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {} @@ -160,6 +175,9 @@ class MatrixWrapper : public MatrixBase > inline Index outerStride() const { return m_expression.outerStride(); } inline Index innerStride() const { return m_expression.innerStride(); } + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + inline const Scalar* data() const { return m_expression.data(); } + inline const CoeffReturnType coeff(Index row, Index col) const { return m_expression.coeff(row, col);