Bugzilla – Attachment 571 Details for
Bug 1009
One-index coeff accessors should static_assert on LinearAccessBit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
[patch]
Add static assertions on linear access. Breaks lots of tests at the moment.
static-assert-linear-access (text/plain), 2.69 KB, created by
Benoit Jacob
on 2015-05-01 15:11:51 UTC
(
hide
)
Description:
Add static assertions on linear access. Breaks lots of tests at the moment.
Filename:
MIME Type:
Creator:
Benoit Jacob
Created:
2015-05-01 15:11:51 UTC
Size:
2.69 KB
patch
obsolete
># HG changeset patch ># Parent cf8979c54d71c062ed5b7d970bb42896f54f4653 >diff --git a/Eigen/src/Core/DenseCoeffsBase.h b/Eigen/src/Core/DenseCoeffsBase.h >--- a/Eigen/src/Core/DenseCoeffsBase.h >+++ b/Eigen/src/Core/DenseCoeffsBase.h >@@ -133,16 +133,19 @@ class DenseCoeffsBase<Derived,ReadOnlyAc > * > * \sa operator[](Index) const, coeffRef(Index), coeff(Index,Index) const > */ > > EIGEN_DEVICE_FUNC > EIGEN_STRONG_INLINE CoeffReturnType > coeff(Index index) const > { >+ EIGEN_STATIC_ASSERT(Derived::Flags & LinearAccessBit, >+ THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) >+ > eigen_internal_assert(index >= 0 && index < size()); > return typename internal::evaluator<Derived>::type(derived()).coeff(index); > } > > > /** \returns the coefficient at given index. > * > * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. >@@ -363,16 +366,18 @@ class DenseCoeffsBase<Derived, WriteAcce > * > * \sa operator[](Index), coeff(Index) const, coeffRef(Index,Index) > */ > > EIGEN_DEVICE_FUNC > EIGEN_STRONG_INLINE Scalar& > coeffRef(Index index) > { >+ EIGEN_STATIC_ASSERT(Derived::Flags & LinearAccessBit, >+ THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) > eigen_internal_assert(index >= 0 && index < size()); > return typename internal::evaluator<Derived>::type(derived()).coeffRef(index); > } > > /** \returns a reference to the coefficient at given index. > * > * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. > * >diff --git a/Eigen/src/Core/util/StaticAssert.h b/Eigen/src/Core/util/StaticAssert.h >--- a/Eigen/src/Core/util/StaticAssert.h >+++ b/Eigen/src/Core/util/StaticAssert.h >@@ -88,17 +88,18 @@ > THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL, > THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES, > YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED, > YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED, > THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE, > THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH, > OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG, > IMPLICIT_CONVERSION_TO_SCALAR_IS_FOR_INNER_PRODUCT_ONLY, >- STORAGE_LAYOUT_DOES_NOT_MATCH >+ STORAGE_LAYOUT_DOES_NOT_MATCH, >+ THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS > }; > }; > > } // end namespace internal > > } // end namespace Eigen > > // Specialized implementation for MSVC to avoid "conditional
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1009
:
570
| 571