Add a data() function in Map and Block

This commit is contained in:
Gael Guennebaud 2009-01-16 10:25:53 +00:00
parent ccdcebcf03
commit 48df9ed715
2 changed files with 2 additions and 3 deletions

View File

@ -146,8 +146,6 @@ template<typename MatrixType, int BlockRows, int BlockCols, int PacketAccess, in
inline int rows() const { return m_blockRows.value(); } inline int rows() const { return m_blockRows.value(); }
inline int cols() const { return m_blockCols.value(); } inline int cols() const { return m_blockCols.value(); }
inline int stride(void) const { return m_matrix.stride(); }
inline Scalar& coeffRef(int row, int col) inline Scalar& coeffRef(int row, int col)
{ {
return m_matrix.const_cast_derived() return m_matrix.const_cast_derived()

View File

@ -63,6 +63,7 @@ template<typename Derived> class MapBase
inline int cols() const { return m_cols.value(); } inline int cols() const { return m_cols.value(); }
inline int stride() const { return derived().stride(); } inline int stride() const { return derived().stride(); }
inline const Scalar* data() const { return m_data; }
/** \returns an expression equivalent to \c *this but having the \c PacketAccess constant /** \returns an expression equivalent to \c *this but having the \c PacketAccess constant
* set to \c ForceAligned. Must be reimplemented by the derived class. */ * set to \c ForceAligned. Must be reimplemented by the derived class. */
@ -149,7 +150,7 @@ template<typename Derived> class MapBase
|| ( rows > 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) || ( rows > 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
&& cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols))); && cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)));
} }
template<typename OtherDerived> template<typename OtherDerived>
Derived& operator+=(const MatrixBase<OtherDerived>& other) Derived& operator+=(const MatrixBase<OtherDerived>& other)
{ return derived() = forceAligned() + other; } { return derived() = forceAligned() + other; }