*forward port fix in MapBase::coeff(int) and coeffRef(int)

*forward port expanded map.cpp unit test
*fix unused variable warnings
This commit is contained in:
Benoit Jacob
2010-01-27 07:11:49 -05:00
parent 7ba9dc07ed
commit 35bacf7cb8
4 changed files with 44 additions and 10 deletions

View File

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