From 766db0202095527d2da0c9eecb829e345dc39279 Mon Sep 17 00:00:00 2001 From: Charles Schlosser Date: Wed, 29 Mar 2023 02:39:45 +0000 Subject: [PATCH] disable raw array indexed view access for 1d arrays --- Eigen/src/plugins/IndexedViewMethods.h | 28 -------------------------- test/indexed_view.cpp | 7 ++----- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/Eigen/src/plugins/IndexedViewMethods.h b/Eigen/src/plugins/IndexedViewMethods.h index cef34a551..27a26816d 100644 --- a/Eigen/src/plugins/IndexedViewMethods.h +++ b/Eigen/src/plugins/IndexedViewMethods.h @@ -183,34 +183,6 @@ std::enable_if_t::value, CoeffReturnType> opera return Base::operator()(internal::eval_expr_given_size(id, size())); } -template -std::enable_if_t> operator()( - const IndicesT (&indices)[IndicesN]) { - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return IndexedView(derived(), IvcIndex(0), indices); -} - -template -std::enable_if_t> operator()( - const IndicesT (&indices)[IndicesN]) const { - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return IndexedView(derived(), IvcIndex(0), indices); -} - -template -std::enable_if_t> operator()( - const IndicesT (&indices)[IndicesN]) { - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return IndexedView(derived(), indices, IvcIndex(0)); -} - -template -std::enable_if_t> operator()( - const IndicesT (&indices)[IndicesN]) const { - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return IndexedView(derived(), indices, IvcIndex(0)); -} - #else // EIGEN_PARSED_BY_DOXYGEN /** diff --git a/test/indexed_view.cpp b/test/indexed_view.cpp index 1eab082b0..84a47679d 100644 --- a/test/indexed_view.cpp +++ b/test/indexed_view.cpp @@ -292,11 +292,8 @@ void check_indexed_view() VERIFY_IS_EQUAL(A(std::array{1, 3, 5}, std::array{3, 1, 6, 5}).RowsAtCompileTime, 3); VERIFY_IS_EQUAL(A(std::array{1, 3, 5}, std::array{3, 1, 6, 5}).ColsAtCompileTime, 4); - VERIFY_IS_APPROX( a({3, 1, 6, 5}), a(std::array{{3, 1, 6, 5}}) ); - VERIFY_IS_EQUAL( a({1,3,5}).SizeAtCompileTime, 3 ); - - VERIFY_IS_APPROX( b({3, 1, 6, 5}), b(std::array{{3, 1, 6, 5}}) ); - VERIFY_IS_EQUAL( b({1,3,5}).SizeAtCompileTime, 3 ); + VERIFY_IS_EQUAL( a(std::array{1,3,5}).SizeAtCompileTime, 3 ); + VERIFY_IS_EQUAL( b(std::array{1,3,5}).SizeAtCompileTime, 3 ); // check mat(i,j) with weird types for i and j {