[libcxx-commits] [libcxx] [libc++][spaceship] Implements X::iterator container requirements. (PR #99343)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 23 09:00:15 PDT 2024
================
@@ -179,6 +183,42 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
return !(__y < __x);
}
+#if _LIBCPP_STD_VER >= 20
+
+template <class _Iter1>
+_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
+operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) noexcept {
+ if constexpr (three_way_comparable<_Iter1, strong_ordering>) {
+ return __x.base() <=> __y.base();
+ } else {
+ if (__x.base() < __y.base())
+ return strong_ordering::less;
+
+ if (__x.base() == __y.base())
+ return strong_ordering::equal;
+
+ return strong_ordering::greater;
+ }
+}
----------------
ldionne wrote:
Can't we simply get rid of this entirely? I think the reason we have those for `operator<` & friends was because we ran into some issue, but I am not certain that issue also exists for `operator<=>`. I would try removing it and see if that works.
https://github.com/llvm/llvm-project/pull/99343
More information about the libcxx-commits
mailing list