Skip to content

Commit c28d8ac

Browse files
authored
Merge 2023-11 LWG Motion 17
P2836R1 std::basic_const_iterator should follow its underlying type's convertibility
2 parents 9e69991 + 1d495a6 commit c28d8ac

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

source/iterators.tex

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4288,6 +4288,13 @@
42884288
template<@\libconcept{sentinel_for}@<Iterator> S>
42894289
constexpr bool operator==(const S& s) const;
42904290

4291+
template<@\exposconcept{not-a-const-iterator}@ CI>
4292+
requires @\exposconcept{constant-iterator}@<CI> && @\libconcept{convertible_to}@<Iterator const&, CI>
4293+
constexpr operator CI() const &;
4294+
template<@\exposconcept{not-a-const-iterator}@ CI>
4295+
requires @\exposconcept{constant-iterator}@<CI> && @\libconcept{convertible_to}@<Iterator, CI>
4296+
constexpr operator CI() &&;
4297+
42914298
constexpr bool operator<(const basic_const_iterator& y) const
42924299
requires @\libconcept{random_access_iterator}@<Iterator>;
42934300
constexpr bool operator>(const basic_const_iterator& y) const
@@ -4590,6 +4597,30 @@
45904597
Equivalent to: \tcode{return \exposid{current_} == s;}
45914598
\end{itemdescr}
45924599

4600+
\begin{itemdecl}
4601+
template<@\exposconcept{not-a-const-iterator}@ CI>
4602+
requires @\exposconcept{constant-iterator}@<CI> && @\libconcept{convertible_to}@<Iterator const&, CI>
4603+
constexpr operator CI() const &;
4604+
\end{itemdecl}
4605+
4606+
\begin{itemdescr}
4607+
\pnum
4608+
\returns
4609+
\exposid{current_}.
4610+
\end{itemdescr}
4611+
4612+
\begin{itemdecl}
4613+
template<@\exposconcept{not-a-const-iterator}@ CI>
4614+
requires @\exposconcept{constant-iterator}@<CI> && @\libconcept{convertible_to}@<Iterator, CI>
4615+
constexpr operator CI() &&;
4616+
\end{itemdecl}
4617+
4618+
\begin{itemdescr}
4619+
\pnum
4620+
\returns
4621+
\tcode{std::move(\exposid{current_})}.
4622+
\end{itemdescr}
4623+
45934624
\indexlibrarymember{operator<}{basic_const_iterator}%
45944625
\indexlibrarymember{operator>}{basic_const_iterator}%
45954626
\indexlibrarymember{operator<=}{basic_const_iterator}%

source/support.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@
725725
#define @\defnlibxname{cpp_lib_quoted_string_io}@ 201304L // also in \libheader{iomanip}
726726
#define @\defnlibxname{cpp_lib_ranges}@ 202302L
727727
// also in \libheader{algorithm}, \libheader{functional}, \libheader{iterator}, \libheader{memory}, \libheader{ranges}
728-
#define @\defnlibxname{cpp_lib_ranges_as_const}@ 202207L // freestanding, also in \libheader{ranges}
728+
#define @\defnlibxname{cpp_lib_ranges_as_const}@ 202311L // freestanding, also in \libheader{ranges}
729729
#define @\defnlibxname{cpp_lib_ranges_as_rvalue}@ 202207L // freestanding, also in \libheader{ranges}
730730
#define @\defnlibxname{cpp_lib_ranges_cartesian_product}@ 202207L // freestanding, also in \libheader{ranges}
731731
#define @\defnlibxname{cpp_lib_ranges_chunk}@ 202202L // freestanding, also in \libheader{ranges}

0 commit comments

Comments
 (0)