Skip to content

Commit

Permalink
P2836R1 std::basic_const_iterator should follow its underlying type’s…
Browse files Browse the repository at this point in the history
… convertibility
  • Loading branch information
jensmaurer committed Nov 16, 2023
1 parent 5c0103c commit 264fe66
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions source/iterators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4288,6 +4288,13 @@
template<@\libconcept{sentinel_for}@<Iterator> S>
constexpr bool operator==(const S& s) const;

template<@\exposconcept{not-a-const-iterator}@ CI>
requires @\exposconcept{constant-iterator}@<CI> && @\libconcept{convertible_to}@<Iterator const&, CI>
constexpr operator CI() const &;
template<@\exposconcept{not-a-const-iterator}@ CI>
requires @\exposconcept{constant-iterator}@<CI> && @\libconcept{convertible_to}@<Iterator, CI>
constexpr operator CI() &&;

constexpr bool operator<(const basic_const_iterator& y) const
requires @\libconcept{random_access_iterator}@<Iterator>;
constexpr bool operator>(const basic_const_iterator& y) const
Expand Down Expand Up @@ -4590,6 +4597,30 @@
Equivalent to: \tcode{return \exposid{current_} == s;}
\end{itemdescr}

\begin{itemdecl}
template<@\exposconcept{not-a-const-iterator}@ CI>
requires @\exposconcept{constant-iterator}@<CI> && @\libconcept{convertible_to}@<Iterator const&, CI>
constexpr operator CI() const &;
\end{itemdecl}

\begin{itemdescr}
\pnum
\returns
\exposid{current_}.
\end{itemdescr}

\begin{itemdecl}
template<@\exposconcept{not-a-const-iterator}@ CI>
requires @\exposconcept{constant-iterator}@<CI> && @\libconcept{convertible_to}@<Iterator, CI>
constexpr operator CI() &&;
\end{itemdecl}

\begin{itemdescr}
\pnum
\returns
\tcode{std::move(\exposid{current_})}.
\end{itemdescr}

\indexlibrarymember{operator<}{basic_const_iterator}%
\indexlibrarymember{operator>}{basic_const_iterator}%
\indexlibrarymember{operator<=}{basic_const_iterator}%
Expand Down
2 changes: 1 addition & 1 deletion source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@
#define @\defnlibxname{cpp_lib_quoted_string_io}@ 201304L // also in \libheader{iomanip}
#define @\defnlibxname{cpp_lib_ranges}@ 202302L
// also in \libheader{algorithm}, \libheader{functional}, \libheader{iterator}, \libheader{memory}, \libheader{ranges}
#define @\defnlibxname{cpp_lib_ranges_as_const}@ 202207L // freestanding, also in \libheader{ranges}
#define @\defnlibxname{cpp_lib_ranges_as_const}@ 202311L // freestanding, also in \libheader{ranges}
#define @\defnlibxname{cpp_lib_ranges_as_rvalue}@ 202207L // freestanding, also in \libheader{ranges}
#define @\defnlibxname{cpp_lib_ranges_cartesian_product}@ 202207L // freestanding, also in \libheader{ranges}
#define @\defnlibxname{cpp_lib_ranges_chunk}@ 202202L // freestanding, also in \libheader{ranges}
Expand Down

0 comments on commit 264fe66

Please sign in to comment.