|
11 | 11 | #define _LIBCPP___ITERATOR_WRAP_ITER_H
|
12 | 12 |
|
13 | 13 | #include <__compare/ordering.h>
|
| 14 | +#include <__concepts/same_as.h> |
14 | 15 | #include <__config>
|
15 | 16 | #include <__iterator/iterator_traits.h>
|
16 | 17 | #include <__memory/addressof.h>
|
@@ -120,8 +121,6 @@ operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
|
120 | 121 | return __x.base() == __y.base();
|
121 | 122 | }
|
122 | 123 |
|
123 |
| -#if _LIBCPP_STD_VER <= 17 |
124 |
| - |
125 | 124 | template <class _Iter1>
|
126 | 125 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
|
127 | 126 | operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
|
@@ -182,21 +181,29 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
|
182 | 181 | return !(__y < __x);
|
183 | 182 | }
|
184 | 183 |
|
185 |
| -#else // _LIBCPP_STD_VER <= 17 |
| 184 | +#if _LIBCPP_STD_VER >= 20 |
186 | 185 |
|
187 | 186 | template <class _Iter1>
|
188 | 187 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
|
189 |
| -operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) noexcept { |
| 188 | +operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) noexcept |
| 189 | + requires requires(const _Iter1& __i) { |
| 190 | + { __i <=> __i } -> same_as<strong_ordering>; |
| 191 | + } |
| 192 | +{ |
190 | 193 | return __x.base() <=> __y.base();
|
191 | 194 | }
|
192 | 195 |
|
193 | 196 | template <class _Iter1, class _Iter2>
|
194 | 197 | _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
|
195 |
| -operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { |
| 198 | +operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept |
| 199 | + requires requires(const _Iter1& __lhs, const _Iter2& __rhs) { |
| 200 | + { __lhs <=> __rhs } -> same_as<strong_ordering>; |
| 201 | + } |
| 202 | +{ |
196 | 203 | return __x.base() <=> __y.base();
|
197 | 204 | }
|
198 | 205 |
|
199 |
| -#endif // _LIBCPP_STD_VER <= 17 |
| 206 | +#endif // _LIBCPP_STD_VER >= 20 |
200 | 207 |
|
201 | 208 | template <class _Iter1, class _Iter2>
|
202 | 209 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
|
0 commit comments