Skip to content

Commit 88125a4

Browse files
burblebeetkoeppe
authored andcommitted
LWG3769 basic_const_iterator::operator== causes infinite constraint recursion
1 parent 3928740 commit 88125a4

File tree

1 file changed

+36
-39
lines changed

1 file changed

+36
-39
lines changed

source/iterators.tex

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4256,34 +4256,35 @@
42564256
requires @\libconcept{random_access_iterator}@<Iterator>;
42574257

42584258
template<@\libconcept{sentinel_for}@<Iterator> S>
4259-
friend constexpr bool operator==(const basic_const_iterator& x, const S& s);
4259+
constexpr bool operator==(const S& s) const;
42604260

4261-
friend constexpr bool operator<(const basic_const_iterator& x, const basic_const_iterator& y)
4261+
constexpr bool operator<(const basic_const_iterator& y) const
42624262
requires @\libconcept{random_access_iterator}@<Iterator>;
4263-
friend constexpr bool operator>(const basic_const_iterator& x, const basic_const_iterator& y)
4263+
constexpr bool operator>(const basic_const_iterator& y) const
42644264
requires @\libconcept{random_access_iterator}@<Iterator>;
4265-
friend constexpr bool operator<=(const basic_const_iterator& x,
4266-
const basic_const_iterator& y)
4265+
constexpr bool operator<=(const basic_const_iterator& y) const
42674266
requires @\libconcept{random_access_iterator}@<Iterator>;
4268-
friend constexpr bool operator>=(const basic_const_iterator& x,
4269-
const basic_const_iterator& y)
4267+
constexpr bool operator>=(const basic_const_iterator& y) const
42704268
requires @\libconcept{random_access_iterator}@<Iterator>;
4271-
friend constexpr auto operator<=>(const basic_const_iterator& x,
4272-
const basic_const_iterator& y)
4269+
constexpr auto operator<=>(const basic_const_iterator& y) const
42734270
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{three_way_comparable}@<Iterator>;
42744271

42754272
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4276-
friend constexpr bool operator<(const basic_const_iterator& x, const I& y)
4273+
constexpr bool operator<(const I& y) const
42774274
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
42784275
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4279-
friend constexpr bool operator>(const basic_const_iterator& x, const I& y)
4276+
constexpr bool operator>(const I& y) const
42804277
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
42814278
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4282-
friend constexpr bool operator<=(const basic_const_iterator& x, const I& y)
4279+
constexpr bool operator<=(const I& y) const
42834280
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
42844281
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4285-
friend constexpr bool operator>=(const basic_const_iterator& x, const I& y)
4282+
constexpr bool operator>=(const I& y) const
42864283
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
4284+
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4285+
constexpr auto operator<=>(const I& y) const
4286+
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I> &&
4287+
@\libconcept{three_way_comparable_with}@<Iterator, I>;
42874288
template<@\exposconcept{not-a-const-iterator}@ I>
42884289
friend constexpr bool operator<(const I& x, const basic_const_iterator& y)
42894290
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
@@ -4296,10 +4297,6 @@
42964297
template<@\exposconcept{not-a-const-iterator}@ I>
42974298
friend constexpr bool operator>=(const I& x, const basic_const_iterator& y)
42984299
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
4299-
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4300-
friend constexpr auto operator<=>(const basic_const_iterator& x, const I& y)
4301-
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I> &&
4302-
@\libconcept{three_way_comparable_with}@<Iterator, I>;
43034300

43044301
friend constexpr basic_const_iterator operator+(const basic_const_iterator& i,
43054302
difference_type n)
@@ -4311,9 +4308,9 @@
43114308
difference_type n)
43124309
requires @\libconcept{random_access_iterator}@<Iterator>;
43134310
template<@\libconcept{sized_sentinel_for}@<Iterator> S>
4314-
friend constexpr difference_type operator-(const basic_const_iterator& x, const S& y);
4315-
template<@\libconcept{sized_sentinel_for}@<Iterator> S>
4316-
requires @\exposconcept{different-from}@<S, basic_const_iterator>
4311+
constexpr difference_type operator-(const S& y) const;
4312+
template<@\exposconcept{not-a-const-iterator}@ S>
4313+
requires @\libconcept{sized_sentinel_for}@<S, Iterator>
43174314
friend constexpr difference_type operator-(const S& x, const basic_const_iterator& y);
43184315
};
43194316
}
@@ -4549,13 +4546,13 @@
45494546
\indexlibrarymember{operator==}{basic_const_iterator}%
45504547
\begin{itemdecl}
45514548
template<@\libconcept{sentinel_for}@<Iterator> S>
4552-
friend constexpr bool operator==(const basic_const_iterator& x, const S& s);
4549+
constexpr bool operator==(const S& s) const;
45534550
\end{itemdecl}
45544551

45554552
\begin{itemdescr}
45564553
\pnum
45574554
\effects
4558-
Equivalent to: \tcode{return x.\exposid{current_} == s;}
4555+
Equivalent to: \tcode{return \exposid{current_} == s;}
45594556
\end{itemdescr}
45604557

45614558
\indexlibrarymember{operator<}{basic_const_iterator}%
@@ -4564,15 +4561,15 @@
45644561
\indexlibrarymember{operator>=}{basic_const_iterator}%
45654562
\indexlibrarymember{operator<=>}{basic_const_iterator}%
45664563
\begin{itemdecl}
4567-
friend constexpr bool operator<(const basic_const_iterator& x, const basic_const_iterator& y)
4564+
constexpr bool operator<(const basic_const_iterator& y) const
45684565
requires @\libconcept{random_access_iterator}@<Iterator>;
4569-
friend constexpr bool operator>(const basic_const_iterator& x, const basic_const_iterator& y)
4566+
constexpr bool operator>(const basic_const_iterator& y) const
45704567
requires @\libconcept{random_access_iterator}@<Iterator>;
4571-
friend constexpr bool operator<=(const basic_const_iterator& x, const basic_const_iterator& y)
4568+
constexpr bool operator<=(const basic_const_iterator& y) const
45724569
requires @\libconcept{random_access_iterator}@<Iterator>;
4573-
friend constexpr bool operator>=(const basic_const_iterator& x, const basic_const_iterator& y)
4570+
constexpr bool operator>=(const basic_const_iterator& y) const
45744571
requires @\libconcept{random_access_iterator}@<Iterator>;
4575-
friend constexpr auto operator<=>(const basic_const_iterator& x, const basic_const_iterator& y)
4572+
constexpr auto operator<=>(const basic_const_iterator& y) const
45764573
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{three_way_comparable}@<Iterator>;
45774574
\end{itemdecl}
45784575

@@ -4583,7 +4580,7 @@
45834580
\pnum
45844581
\effects
45854582
Equivalent to:
4586-
\tcode{return x.\exposid{current_} \placeholder{op} \exposid{y.current_};}
4583+
\tcode{return \exposid{current_} \placeholder{op} \exposid{y.current_};}
45874584
\end{itemdescr}
45884585

45894586
\indexlibrarymember{operator<}{basic_const_iterator}%
@@ -4593,19 +4590,19 @@
45934590
\indexlibrarymember{operator<=>}{basic_const_iterator}%
45944591
\begin{itemdecl}
45954592
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4596-
friend constexpr bool operator<(const basic_const_iterator& x, const I& y)
4593+
constexpr bool operator<(const I& y) const
45974594
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
45984595
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4599-
friend constexpr bool operator>(const basic_const_iterator& x, const I& y)
4596+
constexpr bool operator>(const I& y) const
46004597
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
46014598
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4602-
friend constexpr bool operator<=(const basic_const_iterator& x, const I& y)
4599+
constexpr bool operator<=(const I& y) const
46034600
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
46044601
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4605-
friend constexpr bool operator>=(const basic_const_iterator& x, const I& y)
4602+
constexpr bool operator>=(const I& y) const
46064603
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I>;
46074604
template<@\exposconcept{different-from}@<basic_const_iterator> I>
4608-
friend constexpr auto operator<=>(const basic_const_iterator& x, const I& y)
4605+
constexpr auto operator<=>(const I& y) const
46094606
requires @\libconcept{random_access_iterator}@<Iterator> && @\libconcept{totally_ordered_with}@<Iterator, I> &&
46104607
@\libconcept{three_way_comparable_with}@<Iterator, I>;
46114608
\end{itemdecl}
@@ -4615,8 +4612,8 @@
46154612
Let \tcode{\placeholder{op}} be the operator.
46164613

46174614
\pnum
4618-
\returns
4619-
Equivalent to: \tcode{return x.\exposid{current_} \placeholder{op} y;}
4615+
\effects
4616+
Equivalent to: \tcode{return \exposid{current_} \placeholder{op} y;}
46204617
\end{itemdescr}
46214618

46224619
\indexlibrarymember{operator<}{basic_const_iterator}%
@@ -4675,19 +4672,19 @@
46754672
\indexlibrarymember{operator-}{basic_const_iterator}%
46764673
\begin{itemdecl}
46774674
template<@\libconcept{sized_sentinel_for}@<Iterator> S>
4678-
friend constexpr difference_type operator-(const basic_const_iterator& x, const S& y);
4675+
constexpr difference_type operator-(const S& y) const;
46794676
\end{itemdecl}
46804677

46814678
\begin{itemdescr}
46824679
\pnum
46834680
\effects
4684-
Equivalent to: \tcode{return x.\exposid{current_} - y;}
4681+
Equivalent to: \tcode{return \exposid{current_} - y;}
46854682
\end{itemdescr}
46864683

46874684
\indexlibrarymember{operator-}{basic_const_iterator}%
46884685
\begin{itemdecl}
4689-
template<@\libconcept{sized_sentinel_for}@<Iterator> S>
4690-
requires @\exposconcept{different-from}@<S, basic_const_iterator>
4686+
template<@\exposconcept{not-a-const-iterator}@ S>
4687+
requires @\libconcept{sized_sentinel_for}@<S, Iterator>
46914688
friend constexpr difference_type operator-(const S& x, const basic_const_iterator& y);
46924689
\end{itemdecl}
46934690

0 commit comments

Comments
 (0)