operator<=>(const reverse_iterator<_IteratorL>& __x,
const reverse_iterator<_IteratorR>& __y)
{ return __y.base() <=> __x.base(); }
+
+ // Additional, non-standard overloads to avoid ambiguities with greedy,
+ // unconstrained overloads in associated namespaces.
+
+ template<typename _Iterator>
+ [[nodiscard]]
+ constexpr bool
+ operator==(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+ requires requires { { __x.base() == __y.base() } -> convertible_to<bool>; }
+ { return __x.base() == __y.base(); }
+
+ template<three_way_comparable _Iterator>
+ [[nodiscard]]
+ constexpr compare_three_way_result_t<_Iterator, _Iterator>
+ operator<=>(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+ { return __y.base() <=> __x.base(); }
#endif // C++20
///@}
const __normal_iterator<_IteratorR, _Container>& __rhs)
noexcept(noexcept(std::__detail::__synth3way(__lhs.base(), __rhs.base())))
{ return std::__detail::__synth3way(__lhs.base(), __rhs.base()); }
+
+ template<typename _Iterator, typename _Container>
+ [[nodiscard]]
+ constexpr bool
+ operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
+ const __normal_iterator<_Iterator, _Container>& __rhs)
+ noexcept(noexcept(__lhs.base() == __rhs.base()))
+ requires requires {
+ { __lhs.base() == __rhs.base() } -> std::convertible_to<bool>;
+ }
+ { return __lhs.base() == __rhs.base(); }
+
+ template<typename _Iterator, typename _Container>
+ [[nodiscard]]
+ constexpr std::__detail::__synth3way_t<_Iterator>
+ operator<=>(const __normal_iterator<_Iterator, _Container>& __lhs,
+ const __normal_iterator<_Iterator, _Container>& __rhs)
+ noexcept(noexcept(std::__detail::__synth3way(__lhs.base(), __rhs.base())))
+ { return std::__detail::__synth3way(__lhs.base(), __rhs.base()); }
#else
// Forward iterator requirements
template<typename _IteratorL, typename _IteratorR, typename _Container>
#endif
{ return !(__x < __y); }
-#if ! (__cplusplus > 201703L && __cpp_lib_concepts)
// Note: See __normal_iterator operators note from Gaby to understand
// why we have these extra overloads for some move_iterator operators.
- // These extra overloads are not needed in C++20, because the ones above
- // are constrained with a requires-clause and so overload resolution will
- // prefer them to greedy unconstrained function templates.
-
template<typename _Iterator>
[[__nodiscard__]]
inline _GLIBCXX17_CONSTEXPR bool
const move_iterator<_Iterator>& __y)
{ return __x.base() == __y.base(); }
+#if __cpp_lib_three_way_comparison
+ template<three_way_comparable _Iterator>
+ [[__nodiscard__]]
+ constexpr compare_three_way_result_t<_Iterator>
+ operator<=>(const move_iterator<_Iterator>& __x,
+ const move_iterator<_Iterator>& __y)
+ { return __x.base() <=> __y.base(); }
+#else
template<typename _Iterator>
[[__nodiscard__]]
inline _GLIBCXX17_CONSTEXPR bool