diff --git a/stl/inc/xutility b/stl/inc/xutility index 7a66539e1c..6077729f46 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -1932,72 +1932,74 @@ public: } template _Sent> - _NODISCARD constexpr bool operator==(const _Sent& _Se) const // per LWG-3769 + _NODISCARD constexpr bool operator==(const _Sent& _Se) const noexcept(noexcept(_Fake_copy_init(_Current == _Se))) /* strengthened */ { return _Current == _Se; } - _NODISCARD_FRIEND constexpr bool - operator<(const basic_const_iterator& _Left, const basic_const_iterator& _Right) noexcept( - noexcept(_Fake_copy_init(_Left._Current < _Right._Current))) // strengthened + _NODISCARD constexpr bool operator<(const basic_const_iterator& _Right) const + noexcept(noexcept(_Fake_copy_init(_Current < _Right._Current))) // strengthened requires random_access_iterator<_Iter> { - return _Left._Current < _Right._Current; + return _Current < _Right._Current; } - _NODISCARD_FRIEND constexpr bool - operator>(const basic_const_iterator& _Left, const basic_const_iterator& _Right) noexcept( - noexcept(_Fake_copy_init(_Left._Current > _Right._Current))) // strengthened + _NODISCARD constexpr bool operator>(const basic_const_iterator& _Right) const + noexcept(noexcept(_Fake_copy_init(_Current > _Right._Current))) // strengthened requires random_access_iterator<_Iter> { - return _Left._Current > _Right._Current; + return _Current > _Right._Current; } - _NODISCARD_FRIEND constexpr bool - operator<=(const basic_const_iterator& _Left, const basic_const_iterator& _Right) noexcept( - noexcept(_Fake_copy_init(_Left._Current <= _Right._Current))) // strengthened + _NODISCARD constexpr bool operator<=(const basic_const_iterator& _Right) const + noexcept(noexcept(_Fake_copy_init(_Current <= _Right._Current))) // strengthened requires random_access_iterator<_Iter> { - return _Left._Current <= _Right._Current; + return _Current <= _Right._Current; } - _NODISCARD_FRIEND constexpr bool - operator>=(const basic_const_iterator& _Left, const basic_const_iterator& _Right) noexcept( - noexcept(_Fake_copy_init(_Left._Current >= _Right._Current))) // strengthened + _NODISCARD constexpr bool operator>=(const basic_const_iterator& _Right) const + noexcept(noexcept(_Fake_copy_init(_Current >= _Right._Current))) // strengthened requires random_access_iterator<_Iter> { - return _Left._Current >= _Right._Current; + return _Current >= _Right._Current; } - _NODISCARD_FRIEND constexpr auto operator<=>(const basic_const_iterator& _Left, - const basic_const_iterator& _Right) noexcept(noexcept(_Left._Current <=> _Right._Current)) // strengthened + _NODISCARD constexpr auto operator<=>(const basic_const_iterator& _Right) const + noexcept(noexcept(_Current <=> _Right._Current)) // strengthened requires random_access_iterator<_Iter> && three_way_comparable<_Iter> { - return _Left._Current <=> _Right._Current; + return _Current <=> _Right._Current; } template <_Bci_order<_Iter> _Other> - _NODISCARD_FRIEND constexpr bool operator<(const basic_const_iterator& _Left, const _Other& _Right) noexcept( - noexcept(_Fake_copy_init(_Left._Current < _Right))) /* strengthened */ { - return _Left._Current < _Right; + _NODISCARD constexpr bool operator<(const _Other& _Right) const + noexcept(noexcept(_Fake_copy_init(_Current < _Right))) /* strengthened */ { + return _Current < _Right; } template <_Bci_order<_Iter> _Other> - _NODISCARD_FRIEND constexpr bool operator>(const basic_const_iterator& _Left, const _Other& _Right) noexcept( - noexcept(_Fake_copy_init(_Left._Current > _Right))) /* strengthened */ { - return _Left._Current > _Right; + _NODISCARD constexpr bool operator>(const _Other& _Right) const + noexcept(noexcept(_Fake_copy_init(_Current > _Right))) /* strengthened */ { + return _Current > _Right; } template <_Bci_order<_Iter> _Other> - _NODISCARD_FRIEND constexpr bool operator<=(const basic_const_iterator& _Left, const _Other& _Right) noexcept( - noexcept(_Fake_copy_init(_Left._Current <= _Right))) /* strengthened */ { - return _Left._Current <= _Right; + _NODISCARD constexpr bool operator<=(const _Other& _Right) const + noexcept(noexcept(_Fake_copy_init(_Current <= _Right))) /* strengthened */ { + return _Current <= _Right; } template <_Bci_order<_Iter> _Other> - _NODISCARD_FRIEND constexpr bool operator>=(const basic_const_iterator& _Left, const _Other& _Right) noexcept( - noexcept(_Fake_copy_init(_Left._Current >= _Right))) /* strengthened */ { - return _Left._Current >= _Right; + _NODISCARD constexpr bool operator>=(const _Other& _Right) const + noexcept(noexcept(_Fake_copy_init(_Current >= _Right))) /* strengthened */ { + return _Current >= _Right; + } + + template <_Bci_order_3way<_Iter> _Other> + _NODISCARD constexpr auto operator<=>(const _Other& _Right) const + noexcept(noexcept(_Current <=> _Right)) /* strengthened */ { + return _Current <=> _Right; } template <_Not_bci_order<_Iter> _Other> @@ -2024,12 +2026,6 @@ public: return _Left >= _Right._Current; } - template <_Bci_order_3way<_Iter> _Other> - _NODISCARD_FRIEND constexpr auto operator<=>(const basic_const_iterator& _Left, const _Other& _Right) noexcept( - noexcept(_Left._Current <=> _Right)) /* strengthened */ { - return _Left._Current <=> _Right; - } - _NODISCARD_FRIEND constexpr basic_const_iterator operator+(const basic_const_iterator& _It, const difference_type _Off) noexcept(noexcept(basic_const_iterator{_It._Current + _Off})) // strengthened requires random_access_iterator<_Iter> @@ -2052,7 +2048,7 @@ public: } template _Sent> - _NODISCARD constexpr difference_type operator-(const _Sent& _Se) const // per LWG-3769 + _NODISCARD constexpr difference_type operator-(const _Sent& _Se) const noexcept(noexcept(_Current - _Se)) /* strengthened */ { return _Current - _Se; } @@ -2060,7 +2056,7 @@ public: template <_Not_a_const_iterator _Sent> requires sized_sentinel_for<_Sent, _Iter> _NODISCARD_FRIEND constexpr difference_type operator-(const _Sent& _Se, const basic_const_iterator& _It) noexcept( - noexcept(_Se - _It._Current)) /* strengthened */ { // per LWG-3769 + noexcept(_Se - _It._Current)) /* strengthened */ { return _Se - _It._Current; } };