From 2b561f9284a28b1154df677978ba24ee1b710d58 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen <4643818-rmlarsen1@users.noreply.gitlab.com> Date: Mon, 16 Feb 2026 02:12:28 -0800 Subject: [PATCH] Revert "Specialized enable_borrowed_ranges for VectorwiseOp class range iteration" This reverts merge request !2127 --- Eigen/src/Core/VectorwiseOp.h | 10 ---------- test/CMakeLists.txt | 8 -------- test/vectorwiseop.cpp | 12 ++++++------ test/vectorwiseop_ranges.cpp | 31 ------------------------------- 4 files changed, 6 insertions(+), 55 deletions(-) delete mode 100644 test/vectorwiseop_ranges.cpp diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index 38b996409..9e34d8c99 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -732,14 +732,4 @@ EIGEN_DEVICE_FUNC inline typename DenseBase::RowwiseReturnType DenseBas } // end namespace Eigen -/* Enable use of VectorwiseOp types inside - * of std::ranges algorithms. */ -#if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L -namespace std { -template -inline constexpr bool ranges::enable_borrowed_range> = - true; -} -#endif - #endif // EIGEN_PARTIAL_REDUX_H diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 69e2302dd..dc5f958f1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -304,13 +304,6 @@ if(NOT EIGEN_TEST_NO_EXCEPTIONS) endif() ei_add_test(prec_inverse_4x4) ei_add_test(vectorwiseop) -if("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES) - if(MSVC) - ei_add_test(vectorwiseop_ranges "/std:c++20") - else() - ei_add_test(vectorwiseop_ranges "-std=c++20") - endif() -endif() ei_add_test(special_numbers) ei_add_test(rvalue_types) ei_add_test(dense_storage) @@ -504,7 +497,6 @@ if(EIGEN_TEST_SYCL) set(EIGEN_SYCL OFF) endif() - cmake_dependent_option(EIGEN_TEST_BUILD_DOCUMENTATION "Test building the doxygen documentation" OFF "EIGEN_BUILD_DOC" OFF) if(EIGEN_TEST_BUILD_DOCUMENTATION) add_dependencies(buildtests doc) diff --git a/test/vectorwiseop.cpp b/test/vectorwiseop.cpp index 35f5f665e..d037bb49b 100644 --- a/test/vectorwiseop.cpp +++ b/test/vectorwiseop.cpp @@ -241,11 +241,11 @@ EIGEN_DECLARE_TEST(vectorwiseop) { CALL_SUBTEST_3(vectorwiseop_array(ArrayXXf(3, 4))); CALL_SUBTEST_4(vectorwiseop_matrix(Matrix4cf())); CALL_SUBTEST_5(vectorwiseop_matrix(Matrix4f())); - CALL_SUBTEST_6(vectorwiseop_matrix(Vector4f())); - CALL_SUBTEST_7(vectorwiseop_matrix(Matrix())); - CALL_SUBTEST_8(vectorwiseop_matrix( + CALL_SUBTEST_5(vectorwiseop_matrix(Vector4f())); + CALL_SUBTEST_5(vectorwiseop_matrix(Matrix())); + CALL_SUBTEST_6(vectorwiseop_matrix( MatrixXd(internal::random(1, EIGEN_TEST_MAX_SIZE), internal::random(1, EIGEN_TEST_MAX_SIZE)))); - CALL_SUBTEST_9(vectorwiseop_matrix(VectorXd(internal::random(1, EIGEN_TEST_MAX_SIZE)))); - CALL_SUBTEST_10(vectorwiseop_matrix(RowVectorXd(internal::random(1, EIGEN_TEST_MAX_SIZE)))); - CALL_SUBTEST_11(vectorwiseop_mixedscalar()); + CALL_SUBTEST_7(vectorwiseop_matrix(VectorXd(internal::random(1, EIGEN_TEST_MAX_SIZE)))); + CALL_SUBTEST_7(vectorwiseop_matrix(RowVectorXd(internal::random(1, EIGEN_TEST_MAX_SIZE)))); + CALL_SUBTEST_8(vectorwiseop_mixedscalar()); } diff --git a/test/vectorwiseop_ranges.cpp b/test/vectorwiseop_ranges.cpp deleted file mode 100644 index 903e19233..000000000 --- a/test/vectorwiseop_ranges.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2011 Benoit Jacob -// Copyright (C) 2015 Gael Guennebaud -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#define TEST_ENABLE_TEMPORARY_TRACKING - -#include "main.h" - -#if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L -#include -#endif - -void vectorwiseop_use_in_std_ranges() { - // verify basic std::ranges functionality; noop if ranges not present -#if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L - Matrix3f a = Matrix3f::Random(); - int count = 0; - std::ranges::for_each(a.colwise(), [&count](auto&& col) { count += col.count(); }); - VERIFY_IS_EQUAL(count, 9); - std::ranges::for_each(a.rowwise(), [&count](auto&& row) { count += row.count(); }); - VERIFY_IS_EQUAL(count, 18); -#endif -} - -EIGEN_DECLARE_TEST(vectorwiseop_ranges) { CALL_SUBTEST_1(vectorwiseop_use_in_std_ranges()); }