Skip to content

Commit 5da9ba8

Browse files
committed
P3913R1 Optimize for std::optional in range adaptors
Fixes PL-011 22.5 (C++26 CD). Fixes #8481
1 parent 44ed874 commit 5da9ba8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

source/ranges.tex

Lines changed: 14 additions & 0 deletions
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 \tcode{view},
5904+
then \tcode{(static_cast<D>(F) == D() ? ((void)E, T()) : \placeholdernc{decay-copy}(E))}.
59015905
\item
59025906
Otherwise, if \tcode{T} models
59035907
\libconcept{random_access_range} and \libconcept{sized_range}
@@ -6381,6 +6385,10 @@
63816385
except that the evaluations of \tcode{E} and \tcode{F}
63826386
are indeterminately sequenced.
63836387

6388+
\item
6389+
Otherwise, if \tcode{T} is a specialization of \tcode{optional}
6390+
and \tcode{T} models \tcode{view},
6391+
then \tcode{(static_cast<D>(F) == D() ? \placeholdernc{decay-copy}(E) : ((void)E, T()))}.
63846392
\item
63856393
Otherwise, if \tcode{T} models
63866394
\libconcept{random_access_range} and \libconcept{sized_range}
@@ -9909,6 +9917,9 @@
99099917
If the type of \tcode{E} is
99109918
a (possibly cv-qualified) specialization of \tcode{reverse_view},
99119919
then \tcode{E.base()}.
9920+
\item
9921+
Otherwise, if \tcode{E} is specialization of \tcode{optional} and \tcode{E}
9922+
models \tcode{view}, then \tcode{\placeholdernc{decay-copy}(E)}.
99129923
\item
99139924
Otherwise, if the type of \tcode{E} is \cv{} \tcode{subrange<reverse_iterator<I>, reverse_iterator<I>, K>}
99149925
for some iterator type \tcode{I} and
@@ -10061,6 +10072,9 @@
1006110072
if \tcode{U} denotes \tcode{empty_view<X>}
1006210073
for some type \tcode{X}, then \tcode{auto(views::empty<const X>)}.
1006310074
\item
10075+
Otherwise, if \tcode{U} denotes \tcode{optional<X\&>}
10076+
for some type \tcode{X}, then \tcode{optional<const X\&>(E)}.
10077+
\item
1006410078
Otherwise,
1006510079
if \tcode{U} denotes \tcode{span<X, Extent>}
1006610080
for some type \tcode{X} and some extent \tcode{Extent},

0 commit comments

Comments
 (0)