Skip to content

Commit 39b6900

Browse files
authored
[libc++][spaceship] Removes unneeded relational operators. (#100441)
This is a followup of #99343. Since that patch was quite late in the LLVM-19 release cycle some of the unneeded relational operator were not removed in C++20. This removes them and gives the change a bit more "baking" time, just in case there are issues with this change in user code. This change is intended to be an NFC.
1 parent f08df56 commit 39b6900

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

libcxx/include/__iterator/bounded_iter.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,7 @@ struct __bounded_iter {
209209
operator!=(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT {
210210
return __x.__current_ != __y.__current_;
211211
}
212-
#endif
213212

214-
// TODO(mordante) disable these overloads in the LLVM 20 release.
215213
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR friend bool
216214
operator<(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT {
217215
return __x.__current_ < __y.__current_;
@@ -229,7 +227,7 @@ struct __bounded_iter {
229227
return __x.__current_ >= __y.__current_;
230228
}
231229

232-
#if _LIBCPP_STD_VER >= 20
230+
#else
233231
_LIBCPP_HIDE_FROM_ABI constexpr friend strong_ordering
234232
operator<=>(__bounded_iter const& __x, __bounded_iter const& __y) noexcept {
235233
if constexpr (three_way_comparable<_Iterator, strong_ordering>) {

libcxx/include/__iterator/wrap_iter.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
145145
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT {
146146
return !(__x == __y);
147147
}
148-
#endif
149-
150-
// TODO(mordante) disable these overloads in the LLVM 20 release.
151148
template <class _Iter1>
152149
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
153150
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
@@ -184,7 +181,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
184181
return !(__y < __x);
185182
}
186183

187-
#if _LIBCPP_STD_VER >= 20
184+
#else
188185
template <class _Iter1, class _Iter2>
189186
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
190187
operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept {

libcxx/include/deque

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,6 @@ public:
380380
_LIBCPP_HIDE_FROM_ABI friend bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) {
381381
return !(__x == __y);
382382
}
383-
#endif
384-
385-
// TODO(mordante) disable these overloads in the LLVM 20 release.
386383
_LIBCPP_HIDE_FROM_ABI friend bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) {
387384
return __x.__m_iter_ < __y.__m_iter_ || (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);
388385
}
@@ -399,7 +396,8 @@ public:
399396
return !(__x < __y);
400397
}
401398

402-
#if _LIBCPP_STD_VER >= 20
399+
#else
400+
403401
_LIBCPP_HIDE_FROM_ABI friend strong_ordering operator<=>(const __deque_iterator& __x, const __deque_iterator& __y) {
404402
if (__x.__m_iter_ < __y.__m_iter_)
405403
return strong_ordering::less;

0 commit comments

Comments
 (0)