mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
Add static assertion to y(), z(), w() accessors
This commit is contained in:
parent
6d472d8375
commit
234a1094b7
@ -191,19 +191,31 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
|
|||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE CoeffReturnType
|
EIGEN_STRONG_INLINE CoeffReturnType
|
||||||
y() const { return (*this)[1]; }
|
y() const
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS);
|
||||||
|
return (*this)[1];
|
||||||
|
}
|
||||||
|
|
||||||
/** equivalent to operator[](2). */
|
/** equivalent to operator[](2). */
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE CoeffReturnType
|
EIGEN_STRONG_INLINE CoeffReturnType
|
||||||
z() const { return (*this)[2]; }
|
z() const
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS);
|
||||||
|
return (*this)[2];
|
||||||
|
}
|
||||||
|
|
||||||
/** equivalent to operator[](3). */
|
/** equivalent to operator[](3). */
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE CoeffReturnType
|
EIGEN_STRONG_INLINE CoeffReturnType
|
||||||
w() const { return (*this)[3]; }
|
w() const
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS);
|
||||||
|
return (*this)[3];
|
||||||
|
}
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
* \returns the packet of coefficients starting at the given row and column. It is your responsibility
|
* \returns the packet of coefficients starting at the given row and column. It is your responsibility
|
||||||
@ -424,19 +436,31 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
|
|||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE Scalar&
|
EIGEN_STRONG_INLINE Scalar&
|
||||||
y() { return (*this)[1]; }
|
y()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS);
|
||||||
|
return (*this)[1];
|
||||||
|
}
|
||||||
|
|
||||||
/** equivalent to operator[](2). */
|
/** equivalent to operator[](2). */
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE Scalar&
|
EIGEN_STRONG_INLINE Scalar&
|
||||||
z() { return (*this)[2]; }
|
z()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS);
|
||||||
|
return (*this)[2];
|
||||||
|
}
|
||||||
|
|
||||||
/** equivalent to operator[](3). */
|
/** equivalent to operator[](3). */
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE Scalar&
|
EIGEN_STRONG_INLINE Scalar&
|
||||||
w() { return (*this)[3]; }
|
w()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS);
|
||||||
|
return (*this)[3];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Base class providing direct read-only coefficient access to matrices and arrays.
|
/** \brief Base class providing direct read-only coefficient access to matrices and arrays.
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE,
|
THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE,
|
||||||
THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE,
|
THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE,
|
||||||
THIS_METHOD_IS_ONLY_FOR_OBJECTS_OF_A_SPECIFIC_SIZE,
|
THIS_METHOD_IS_ONLY_FOR_OBJECTS_OF_A_SPECIFIC_SIZE,
|
||||||
|
OUT_OF_RANGE_ACCESS,
|
||||||
YOU_MADE_A_PROGRAMMING_MISTAKE,
|
YOU_MADE_A_PROGRAMMING_MISTAKE,
|
||||||
EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT,
|
EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT,
|
||||||
EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE,
|
EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user