Skip to content

Commit 731dea4

Browse files
steve-downeytkoeppe
authored andcommitted
P3913R1 Optimize for std::optional in range adaptors
Fixes NB PL 011 (C++26 CD).
1 parent cc63c64 commit 731dea4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

source/ranges.tex

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5898,6 +5898,11 @@
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))}.
5905+
59015906
\item
59025907
Otherwise, if \tcode{T} models
59035908
\libconcept{random_access_range} and \libconcept{sized_range}
@@ -6381,6 +6386,11 @@
63816386
except that the evaluations of \tcode{E} and \tcode{F}
63826387
are indeterminately sequenced.
63836388

6389+
\item
6390+
Otherwise, if \tcode{T} is a specialization of \tcode{optional}
6391+
and \tcode{T} models \libconcept{view}, then
6392+
\tcode{(static_cast<D>(F) == D() ? \exposidnc{decay-copy}(E) : ((void)E, T()))}.
6393+
63846394
\item
63856395
Otherwise, if \tcode{T} models
63866396
\libconcept{random_access_range} and \libconcept{sized_range}
@@ -9910,6 +9920,11 @@
99109920
If the type of \tcode{E} is
99119921
a (possibly cv-qualified) specialization of \tcode{reverse_view},
99129922
then \tcode{E.base()}.
9923+
9924+
\item
9925+
Otherwise, if \tcode{E} is specialization of \tcode{optional} and \tcode{E}
9926+
models \libconcept{view}, then \tcode{\exposidnc{decay-copy}(E)}.
9927+
99139928
\item
99149929
Otherwise, if the type of \tcode{E} is \cv{} \tcode{subrange<reverse_iterator<I>, reverse_iterator<I>, K>}
99159930
for some iterator type \tcode{I} and
@@ -10061,6 +10076,11 @@
1006110076
Otherwise,
1006210077
if \tcode{U} denotes \tcode{empty_view<X>}
1006310078
for some type \tcode{X}, then \tcode{auto(views::empty<const X>)}.
10079+
10080+
\item
10081+
Otherwise, if \tcode{U} denotes \tcode{optional<X\&>}
10082+
for some type \tcode{X}, then \tcode{optional<const X\&>(E)}.
10083+
1006410084
\item
1006510085
Otherwise,
1006610086
if \tcode{U} denotes \tcode{span<X, Extent>}

0 commit comments

Comments
 (0)