Created on 2020-06-06.00:00:00 last changed 13 months ago
Proposed resolution:
This wording is relative to N4861. It assumes the maybe-const helper introduced by the P/R of LWG 3448.
Modify [range.take.sentinel] as indicated:
[Drafting note: Unlike LWG 3448, these operators can't be easily templatized, so the approach taken here is to add an overload for the opposite constness instead. However, because const V may not even be a range (and therefore iterator_t<const V> may not be well-formed), we need to defer instantiating the signature of the new overload until the point of use. ]
[…]namespace std::ranges { template<view V> template<bool Const> class take_view<V>::sentinel { private: using Base = conditional_t<Const, const V, V>; // exposition only template<bool OtherConst> using CI = counted_iterator<iterator_t<Basemaybe-const<OtherConst, V>>>; // exposition only […] constexpr sentinel_t<Base> base() const; friend constexpr bool operator==(const CI<Const>& y, const sentinel& x); template<bool OtherConst = !Const> requires sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>> friend constexpr bool operator==(const CI<OtherConst>& y, const sentinel& x); }; }friend constexpr bool operator==(const CI<Const>& y, const sentinel& x); template<bool OtherConst = !Const> requires sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>> friend constexpr bool operator==(const CI<OtherConst>& y, const sentinel& x);-4- Effects: Equivalent to: return y.count() == 0 || y.base() == x.end_;
Modify [range.take.while.sentinel] as indicated:
[…]namespace std::ranges { template<view V, class Pred> requires input_range<V> && is_object_v<Pred> && indirect_unary_predicate<const Pred, iterator_t<V>> template<bool Const> class take_while_view<V>::sentinel { […] constexpr sentinel_t<Base> base() const { return end_; } friend constexpr bool operator==(const iterator_t<Base>& x, const sentinel& y); template<bool OtherConst = !Const> requires sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>> friend constexpr bool operator==(const iterator_t<maybe-const<OtherConst, V>>& x, const sentinel& y); }; }friend constexpr bool operator==(const iterator_t<Base>& x, const sentinel& y); template<bool OtherConst = !Const> requires sentinel_for<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>> friend constexpr bool operator==(const iterator_t<maybe-const<OtherConst, V>>& x, const sentinel& y);-3- Effects: Equivalent to: return y.end_ == x || !invoke(*y.pred_, *x);
[ 2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP. ]
[ 2020-10-02; Status to Tentatively Ready after five positive votes on the reflector ]
[ 2020-06-15 Tim corrects a typo in the PR ]
During reflector discussion it was noted that the issue observed in LWG 3448 applies to take_view::sentinel and take_while_view::sentinel as well.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2020-11-09 21:40:50 | admin | set | messages: + msg11578 |
2020-11-09 21:40:50 | admin | set | status: ready -> wp |
2020-10-02 17:02:44 | admin | set | messages: + msg11497 |
2020-10-02 17:02:44 | admin | set | status: new -> ready |
2020-07-17 22:37:26 | admin | set | messages: + msg11400 |
2020-06-15 13:30:14 | admin | set | messages: + msg11336 |
2020-06-06 13:46:40 | admin | set | messages: + msg11323 |
2020-06-06 00:00:00 | admin | create |