mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-05 04:35:46 +08:00
disable raw array indexed view access for 1d arrays
This commit is contained in:
parent
bfbc66e078
commit
766db02020
@ -183,34 +183,6 @@ std::enable_if_t<symbolic::is_symbolic<IndexType>::value, CoeffReturnType> opera
|
|||||||
return Base::operator()(internal::eval_expr_given_size(id, size()));
|
return Base::operator()(internal::eval_expr_given_size(id, size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename IndicesT, std::size_t IndicesN>
|
|
||||||
std::enable_if_t<IsRowMajor, IndexedView<Derived, IvcIndex, const IndicesT (&)[IndicesN]>> operator()(
|
|
||||||
const IndicesT (&indices)[IndicesN]) {
|
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
|
||||||
return IndexedView<Derived, IvcIndex, const IndicesT(&)[IndicesN]>(derived(), IvcIndex(0), indices);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename IndicesT, std::size_t IndicesN>
|
|
||||||
std::enable_if_t<IsRowMajor, IndexedView<const Derived, IvcIndex, const IndicesT (&)[IndicesN]>> operator()(
|
|
||||||
const IndicesT (&indices)[IndicesN]) const {
|
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
|
||||||
return IndexedView<const Derived, IvcIndex, const IndicesT(&)[IndicesN]>(derived(), IvcIndex(0), indices);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename IndicesT, std::size_t IndicesN>
|
|
||||||
std::enable_if_t<!IsRowMajor, IndexedView<Derived, const IndicesT (&)[IndicesN], IvcIndex>> operator()(
|
|
||||||
const IndicesT (&indices)[IndicesN]) {
|
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
|
||||||
return IndexedView<Derived, const IndicesT(&)[IndicesN], IvcIndex>(derived(), indices, IvcIndex(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename IndicesT, std::size_t IndicesN>
|
|
||||||
std::enable_if_t<!IsRowMajor, IndexedView<const Derived, const IndicesT (&)[IndicesN], IvcIndex>> operator()(
|
|
||||||
const IndicesT (&indices)[IndicesN]) const {
|
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
|
||||||
return IndexedView<const Derived, const IndicesT(&)[IndicesN], IvcIndex>(derived(), indices, IvcIndex(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // EIGEN_PARSED_BY_DOXYGEN
|
#else // EIGEN_PARSED_BY_DOXYGEN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -292,11 +292,8 @@ void check_indexed_view()
|
|||||||
VERIFY_IS_EQUAL(A(std::array<int, 3>{1, 3, 5}, std::array<int, 4>{3, 1, 6, 5}).RowsAtCompileTime, 3);
|
VERIFY_IS_EQUAL(A(std::array<int, 3>{1, 3, 5}, std::array<int, 4>{3, 1, 6, 5}).RowsAtCompileTime, 3);
|
||||||
VERIFY_IS_EQUAL(A(std::array<int, 3>{1, 3, 5}, std::array<int, 4>{3, 1, 6, 5}).ColsAtCompileTime, 4);
|
VERIFY_IS_EQUAL(A(std::array<int, 3>{1, 3, 5}, std::array<int, 4>{3, 1, 6, 5}).ColsAtCompileTime, 4);
|
||||||
|
|
||||||
VERIFY_IS_APPROX( a({3, 1, 6, 5}), a(std::array<int,4>{{3, 1, 6, 5}}) );
|
VERIFY_IS_EQUAL( a(std::array<int,3>{1,3,5}).SizeAtCompileTime, 3 );
|
||||||
VERIFY_IS_EQUAL( a({1,3,5}).SizeAtCompileTime, 3 );
|
VERIFY_IS_EQUAL( b(std::array<int,3>{1,3,5}).SizeAtCompileTime, 3 );
|
||||||
|
|
||||||
VERIFY_IS_APPROX( b({3, 1, 6, 5}), b(std::array<int,4>{{3, 1, 6, 5}}) );
|
|
||||||
VERIFY_IS_EQUAL( b({1,3,5}).SizeAtCompileTime, 3 );
|
|
||||||
|
|
||||||
// check mat(i,j) with weird types for i and j
|
// check mat(i,j) with weird types for i and j
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user