mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-10 18:59:01 +08:00
fix bug in MapBase found by myguel
This commit is contained in:
parent
51c991af45
commit
59a1ed0932
@ -96,7 +96,11 @@ template<typename Derived> class MapBase
|
|||||||
|
|
||||||
inline Scalar& coeffRef(int index)
|
inline Scalar& coeffRef(int index)
|
||||||
{
|
{
|
||||||
return *const_cast<Scalar*>(m_data + index);
|
ei_assert(Derived::IsVectorAtCompileTime || (ei_traits<Derived>::Flags & LinearAccessBit));
|
||||||
|
if ( ((RowsAtCompileTime == 1) == IsRowMajor) )
|
||||||
|
return const_cast<Scalar*>(m_data)[index];
|
||||||
|
else
|
||||||
|
return const_cast<Scalar*>(m_data)[index*stride()];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int LoadMode>
|
template<int LoadMode>
|
||||||
@ -150,7 +154,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; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user