now if Derived has the DirectAccess flag, then MatrixBase<Derived>::coeff() const returns a const Scalar& and not a Scalar as before.

useful for people doing direct access. + 1 bugfix thanks to Patrick Mihelich, forgot a & in MapBase::coeff(int).
This commit is contained in:
Benoit Jacob
2009-04-01 00:39:56 +00:00
parent 2f45eeb0c6
commit 113fc3a260
3 changed files with 23 additions and 19 deletions

View File

@@ -96,7 +96,7 @@ template<typename Derived> class MapBase
return const_cast<Scalar*>(m_data)[row + col * stride()];
}
inline const Scalar coeff(int index) const
inline const Scalar& coeff(int index) const
{
ei_assert(Derived::IsVectorAtCompileTime || (ei_traits<Derived>::Flags & LinearAccessBit));
if ( ((RowsAtCompileTime == 1) == IsRowMajor) )