Skip to content

Commit c1f613a

Browse files
committed
P3913R1 Optimize for std::optional in range adaptors
Fixes #8481 Fixes NB PL-011 (C++26 CD) Also fixes cplusplus/nbballot#783
1 parent 44ed874 commit c1f613a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

source/ranges.tex

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5898,6 +5898,10 @@
58985898
except that the evaluations of \tcode{E} and \tcode{F}
58995899
are indeterminately sequenced.
59005900

5901+
\item
5902+
Otherwise, if \tcode{T} is a specialization of
5903+
\tcode{optional} and \tcode{T} models \libconcept{view}, then
5904+
\tcode{(static_cast<D>(F) == D() ? ((void)E, T()) : \exposidnc{decay-copy}(E))}.
59015905
\item
59025906
Otherwise, if \tcode{T} models
59035907
\libconcept{random_access_range} and \libconcept{sized_range}
@@ -6380,7 +6384,10 @@
63806384
then \tcode{((void)F, \exposidnc{decay-copy}(E))},
63816385
except that the evaluations of \tcode{E} and \tcode{F}
63826386
are indeterminately sequenced.
6383-
6387+
\item
6388+
Otherwise, if \tcode{T} is a specialization of \tcode{optional}
6389+
and \tcode{T} models \libconcept{view}, then
6390+
\tcode{(static_cast<D>(F) == D() ? \exposidnc{decay-copy}(E) : ((void)E, T()))}.
63846391
\item
63856392
Otherwise, if \tcode{T} models
63866393
\libconcept{random_access_range} and \libconcept{sized_range}
@@ -9909,6 +9916,9 @@
99099916
If the type of \tcode{E} is
99109917
a (possibly cv-qualified) specialization of \tcode{reverse_view},
99119918
then \tcode{E.base()}.
9919+
\item
9920+
Otherwise, if \tcode{E} is specialization of \tcode{optional} and \tcode{E}
9921+
models \libconcept{view}, then \tcode{\exposidnc{decay-copy}(E)}.
99129922
\item
99139923
Otherwise, if the type of \tcode{E} is \cv{} \tcode{subrange<reverse_iterator<I>, reverse_iterator<I>, K>}
99149924
for some iterator type \tcode{I} and
@@ -10061,6 +10071,9 @@
1006110071
if \tcode{U} denotes \tcode{empty_view<X>}
1006210072
for some type \tcode{X}, then \tcode{auto(views::empty<const X>)}.
1006310073
\item
10074+
Otherwise, if \tcode{U} denotes \tcode{optional<X\&>}
10075+
for some type \tcode{X}, then \tcode{optional<const X\&>(E)}.
10076+
\item
1006410077
Otherwise,
1006510078
if \tcode{U} denotes \tcode{span<X, Extent>}
1006610079
for some type \tcode{X} and some extent \tcode{Extent},

0 commit comments

Comments
 (0)