On 27/03/20 23:29 +0000, Jonathan Wakely wrote:
@@ -403,6 +428,49 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator>=(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) { return !(__x < __y); } +#else // C++20 + template<typename _IteratorL, typename _IteratorR> + constexpr auto + operator==(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + -> decltype(__detail::__convbool(__x.base() == __y.base())) + { return __x.base() == __y.base(); } + + template<typename _IteratorL, typename _IteratorR> + constexpr auto + operator!=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + -> decltype(__detail::__convbool(__x.base() != __y.base())) + { return __x.base() != __y.base(); } + + template<typename _IteratorL, typename _IteratorR> + constexpr auto + operator<(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + -> decltype(__detail::__convbool(__x.base() < __y.base())) + { return __x.base() < __y.base(); }
Drat, these relational operators use the wrong operator. The sense needs to be flipped because they're reverse_iterators. Looks like I lost an edit to this file that I made on another machine, and committed the wrong version. I'll fix it ASAP.
+ template<typename _IteratorL, typename _IteratorR> + constexpr auto + operator>(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + -> decltype(__detail::__convbool(__x.base() > __y.base())) + { return __x.base() > __y.base(); } + + template<typename _IteratorL, typename _IteratorR> + constexpr auto + operator<=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + -> decltype(__detail::__convbool(__x.base() <= __y.base())) + { return __x.base() <= __y.base(); } + + template<typename _IteratorL, typename _IteratorR> + constexpr auto + operator>=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + -> decltype(__detail::__convbool(__x.base() >= __y.base())) + { return __x.base() >= __y.base(); } +#endif // C++20 //@} #if __cplusplus < 201103L