Skip to content

Commit a784850

Browse files
burblebeetkoeppe
authored andcommitted
LWG3449 take_view and take_while_view's sentinel<false> not comparable with their const iterator
1 parent c8e7ca4 commit a784850

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

source/ranges.tex

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4422,9 +4422,10 @@
44224422
template<bool Const>
44234423
class take_view<V>::@\exposid{sentinel}@ {
44244424
private:
4425-
using @\exposid{Base}@ = @\exposid{maybe-const}@<Const, V>; // \expos
4426-
using @\exposid{CI}@ = counted_iterator<iterator_t<@\exposid{Base}@>>; // \expos
4427-
sentinel_t<@\exposid{Base}@> @\exposid{end_}@ = sentinel_t<@\exposid{Base}@>(); // \expos
4425+
using @\exposid{Base}@ = @\exposid{maybe-const}@<Const, V>; // \expos
4426+
template<bool OtherConst>
4427+
using @\exposid{CI}@ = counted_iterator<iterator_t<@\exposid{maybe-const}@<OtherConst, V>>>; // \expos
4428+
sentinel_t<@\exposid{Base}@> @\exposid{end_}@ = sentinel_t<@\exposid{Base}@>(); // \expos
44284429
public:
44294430
@\exposid{sentinel}@() = default;
44304431
constexpr explicit @\exposid{sentinel}@(sentinel_t<@\exposid{Base}@> end);
@@ -4433,7 +4434,11 @@
44334434

44344435
constexpr sentinel_t<@\exposid{Base}@> base() const;
44354436

4436-
friend constexpr bool operator==(const @\exposid{CI}@& y, const @\exposid{sentinel}@& x);
4437+
friend constexpr bool operator==(const @\exposid{CI}@<Const>& y, const @\exposid{sentinel}@& x);
4438+
4439+
template<bool OtherConst = !Const>
4440+
requires @\libconcept{sentinel_for}@<sentinel_t<@\exposid{Base}@>, iterator_t<@\exposid{maybe-const}@<OtherConst, V>>>
4441+
friend constexpr bool operator==(const @\exposid{CI}@<OtherConst>& y, const @\exposid{sentinel}@& x);
44374442
};
44384443
}
44394444
\end{codeblock}
@@ -4474,7 +4479,11 @@
44744479

44754480
\indexlibrarymember{operator==}{take_view::sentinel}%
44764481
\begin{itemdecl}
4477-
friend constexpr bool operator==(const @\exposid{CI}@& y, const @\exposid{sentinel}@& x);
4482+
friend constexpr bool operator==(const @\exposid{CI}@<Const>& y, const @\exposid{sentinel}@& x);
4483+
4484+
template<bool OtherConst = !Const>
4485+
requires @\libconcept{sentinel_for}@<sentinel_t<@\exposid{Base}@>, iterator_t<@\exposid{maybe-const}@<OtherConst, V>>>
4486+
friend constexpr bool operator==(const @\exposid{CI}@<OtherConst>& y, const @\exposid{sentinel}@& x);
44784487
\end{itemdecl}
44794488

44804489
\begin{itemdescr}
@@ -4611,6 +4620,11 @@
46114620
constexpr sentinel_t<@\exposid{Base}@> base() const { return @\exposid{end_}@; }
46124621

46134622
friend constexpr bool operator==(const iterator_t<@\exposid{Base}@>& x, const @\exposid{sentinel}@& y);
4623+
4624+
template<bool OtherConst = !Const>
4625+
requires @\libconcept{sentinel_for}@<sentinel_t<@\exposid{Base}@>, iterator_t<@\exposid{maybe-const}@<OtherConst, V>>>
4626+
friend constexpr bool operator==(const iterator_t<@\exposid{maybe-const}@<OtherConst, V>>& x,
4627+
const @\exposid{sentinel}@& y);
46144628
};
46154629
}
46164630
\end{codeblock}
@@ -4642,6 +4656,11 @@
46424656
\indexlibrarymember{operator==}{take_while_view::sentinel}%
46434657
\begin{itemdecl}
46444658
friend constexpr bool operator==(const iterator_t<@\exposid{Base}@>& x, const @\exposid{sentinel}@& y);
4659+
4660+
template<bool OtherConst = !Const>
4661+
requires @\libconcept{sentinel_for}@<sentinel_t<@\exposid{Base}@>, iterator_t<@\exposid{maybe-const}@<OtherConst, V>>>
4662+
friend constexpr bool operator==(const iterator_t<@\exposid{maybe-const}@<OtherConst, V>>& x,
4663+
const @\exposid{sentinel}@& y);
46454664
\end{itemdecl}
46464665

46474666
\begin{itemdescr}

0 commit comments

Comments
 (0)