mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 12:19:12 +08:00
allow matrix[index] in EIGEN2_SUPPORT
This commit is contained in:
parent
c90d0c363b
commit
fe3bb545e0
@ -162,8 +162,10 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
|
|||||||
EIGEN_STRONG_INLINE CoeffReturnType
|
EIGEN_STRONG_INLINE CoeffReturnType
|
||||||
operator[](Index index) const
|
operator[](Index index) const
|
||||||
{
|
{
|
||||||
|
#ifndef EIGEN2_SUPPORT
|
||||||
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
|
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
|
||||||
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
|
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
|
||||||
|
#endif
|
||||||
eigen_assert(index >= 0 && index < size());
|
eigen_assert(index >= 0 && index < size());
|
||||||
return derived().coeff(index);
|
return derived().coeff(index);
|
||||||
}
|
}
|
||||||
@ -379,8 +381,10 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
|
|||||||
EIGEN_STRONG_INLINE Scalar&
|
EIGEN_STRONG_INLINE Scalar&
|
||||||
operator[](Index index)
|
operator[](Index index)
|
||||||
{
|
{
|
||||||
|
#ifndef EIGEN2_SUPPORT
|
||||||
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
|
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
|
||||||
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
|
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
|
||||||
|
#endif
|
||||||
eigen_assert(index >= 0 && index < size());
|
eigen_assert(index >= 0 && index < size());
|
||||||
return derived().coeffRef(index);
|
return derived().coeffRef(index);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user