Skip to content

Commit ab4d296

Browse files
committed
C++20 partial compatibility fix
1 parent f0d47ad commit ab4d296

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

cpp/src/arrow/sparse_tensor.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,18 @@ std::string SparseCSFIndex::ToString() const { return std::string("SparseCSFInde
406406

407407
bool SparseCSFIndex::Equals(const SparseCSFIndex& other) const {
408408
auto eq = [](const auto& a, const auto& b) { return a->Equals(*b); };
409+
// TODO: remove the use of std::equal when we no longer have partial C++20 support with CRAN.
410+
#if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L
409411
return axis_order() == other.axis_order() &&
410412
std::ranges::equal(indices(), other.indices(), eq) &&
411413
std::ranges::equal(indptr(), other.indptr(), eq);
414+
#else
415+
return axis_order() == other.axis_order() &&
416+
std::equal(indices().begin(), indices().end(), other.indices().begin(),
417+
other.indices().end(), eq) &&
418+
std::equal(indptr().begin(), indptr().end(), other.indptr().begin(),
419+
other.indptr().end(), eq);
420+
#endif
412421
}
413422

414423
// ----------------------------------------------------------------------

0 commit comments

Comments
 (0)