This is an automated email from the ASF dual-hosted git repository.
thisisnic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new b5eb42e765 GH-49287: [C++][R] Clean up any other C++20 partial
compatibility issues (#49223)
b5eb42e765 is described below
commit b5eb42e7658c3cbd05cfc673297bf4a7e46da574
Author: Jonathan Keane <[email protected]>
AuthorDate: Wed Feb 18 07:30:45 2026 -0600
GH-49287: [C++][R] Clean up any other C++20 partial compatibility issues
(#49223)
Now that we have CI for it, check on other issues with C++20 compatibility
on CRAN. I know that the code in #49105 is likely problematic
Resolves: #49287
### Rationale for this change
### What changes are included in this PR?
### Are these changes tested?
### Are there any user-facing changes?
* GitHub Issue: #49287
Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Nic Crane <[email protected]>
---
cpp/src/arrow/sparse_tensor.cc | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/cpp/src/arrow/sparse_tensor.cc b/cpp/src/arrow/sparse_tensor.cc
index 477fa2f765..0852a0cdb8 100644
--- a/cpp/src/arrow/sparse_tensor.cc
+++ b/cpp/src/arrow/sparse_tensor.cc
@@ -406,9 +406,19 @@ std::string SparseCSFIndex::ToString() const { return
std::string("SparseCSFInde
bool SparseCSFIndex::Equals(const SparseCSFIndex& other) const {
auto eq = [](const auto& a, const auto& b) { return a->Equals(*b); };
+// TODO: remove the use of std::equal when we no longer have partial C++20
support with
+// CRAN.
+#if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L
return axis_order() == other.axis_order() &&
std::ranges::equal(indices(), other.indices(), eq) &&
std::ranges::equal(indptr(), other.indptr(), eq);
+#else
+ return axis_order() == other.axis_order() &&
+ std::equal(indices().begin(), indices().end(),
other.indices().begin(),
+ other.indices().end(), eq) &&
+ std::equal(indptr().begin(), indptr().end(), other.indptr().begin(),
+ other.indptr().end(), eq);
+#endif
}
// ----------------------------------------------------------------------