Created on 2020-02-07.00:00:00 last changed 46 months ago
Proposed resolution:
This wording is relative to N4849.
Modify [range.iota.iterator] as indicated:
namespace std::ranges { template<class W, class Bound> struct iota_view<W, Bound>::iterator { […] friend constexpr[…]compare_three_way_result_t<W>auto operator<=>( const iterator& x, const iterator& y) requires totally_ordered<W> && three_way_comparable<W>; […] }; […] }friend constexprcompare_three_way_result_t<W>auto operator<=>(const iterator& x, const iterator& y) requires totally_ordered<W> && three_way_comparable<W>;-19- Effects: Equivalent to: return x.value_ <=> y.value_;
Modify [range.transform.iterator] as indicated:
namespace std::ranges { template<class V, class F> template<bool Const> class transform_view<V, F>::iterator { […] friend constexpr[…]compare_three_way_result_t<iterator_t<Base>>auto operator<=>(const iterator& x, const iterator& y) requires random_access_range<Base> && three_way_comparable<iterator_t<Base>>; […] }; […] }friend constexprcompare_three_way_result_t<iterator_t<Base>>auto operator<=>(const iterator& x, const iterator& y) requires random_access_range<Base> && three_way_comparable<iterator_t<Base>>;-19- Effects: Equivalent to: return x.current_ <=> y.current_;
Modify [range.elements.iterator] as indicated:
namespace std::ranges { template<class V, size_t N> template<bool Const> class elements_view<V, N>::iterator { […] friend constexpr[…]compare_three_way_result_t<iterator_t<base-t>>auto operator<=>(const iterator& x, const iterator& y) requires random_access_range<base-t> && three_way_comparable<iterator_t<base-t>>; […] }; […] }friend constexprcompare_three_way_result_t<iterator_t<base-t>>auto operator<=>(const iterator& x, const iterator& y) requires random_access_range<base-t> && three_way_comparable<iterator_t<base-t>>;-18- Effects: Equivalent to: return x.current_ <=> y.current_;
[ 2020-02 Prioritized as IMMEDIATE Monday morning in Prague ]
[range.iota.iterator] and [range.transform.iterator] and [range.elements.iterator] all declare operator<=> similar to this:
friend constexpr compare_three_way_result_t<W> operator<=>( const iterator& x, const iterator& y) requires totally_ordered<W> && three_way_comparable<W>;
Similar to issue 3347 and issue 3387, this is ill-formed if three_way_comparable<W> is not satisfied, because compare_three_way_result_t<W> is invalid. This declaration is instantiated when the enclosing iterator type is instantiated, making any use of iota_view<W, B>::iterator ill-formed when three_way_comparable<W> is not satisfied.
We can either add an exposition-only safe-compare-three-way-result-t alias that denotes void or std::nonesuch for spaceship-less types, so the declaration is valid (and then disabled by the constraints), or simply make them return auto.History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2020-02-24 16:02:59 | admin | set | status: immediate -> wp |
2020-02-10 19:13:13 | admin | set | messages: + msg11023 |
2020-02-10 19:13:13 | admin | set | status: new -> immediate |
2020-02-08 13:14:45 | admin | set | messages: + msg10994 |
2020-02-07 00:00:00 | admin | create |