From c1f613a296c6b3318d93ceb122007df590011e6c Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Tue, 11 Nov 2025 07:44:14 -0500 Subject: [PATCH 1/2] P3913R1 Optimize for std::optional in range adaptors Fixes #8481 Fixes NB PL-011 (C++26 CD) Also fixes https://github.com/cplusplus/nbballot/issues/783 --- source/ranges.tex | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/ranges.tex b/source/ranges.tex index c93b855ec9..b28f0bb4fa 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -5898,6 +5898,10 @@ except that the evaluations of \tcode{E} and \tcode{F} are indeterminately sequenced. +\item +Otherwise, if \tcode{T} is a specialization of +\tcode{optional} and \tcode{T} models \libconcept{view}, then +\tcode{(static_cast(F) == D() ? ((void)E, T()) : \exposidnc{decay-copy}(E))}. \item Otherwise, if \tcode{T} models \libconcept{random_access_range} and \libconcept{sized_range} @@ -6380,7 +6384,10 @@ then \tcode{((void)F, \exposidnc{decay-copy}(E))}, except that the evaluations of \tcode{E} and \tcode{F} are indeterminately sequenced. - +\item +Otherwise, if \tcode{T} is a specialization of \tcode{optional} +and \tcode{T} models \libconcept{view}, then +\tcode{(static_cast(F) == D() ? \exposidnc{decay-copy}(E) : ((void)E, T()))}. \item Otherwise, if \tcode{T} models \libconcept{random_access_range} and \libconcept{sized_range} @@ -9909,6 +9916,9 @@ If the type of \tcode{E} is a (possibly cv-qualified) specialization of \tcode{reverse_view}, then \tcode{E.base()}. +\item + Otherwise, if \tcode{E} is specialization of \tcode{optional} and \tcode{E} + models \libconcept{view}, then \tcode{\exposidnc{decay-copy}(E)}. \item Otherwise, if the type of \tcode{E} is \cv{} \tcode{subrange, reverse_iterator, K>} for some iterator type \tcode{I} and @@ -10061,6 +10071,9 @@ if \tcode{U} denotes \tcode{empty_view} for some type \tcode{X}, then \tcode{auto(views::empty)}. \item +Otherwise, if \tcode{U} denotes \tcode{optional} +for some type \tcode{X}, then \tcode{optional(E)}. +\item Otherwise, if \tcode{U} denotes \tcode{span} for some type \tcode{X} and some extent \tcode{Extent}, From 0b4cae3d2e6a4ad326261f842ae324d83f1c71e5 Mon Sep 17 00:00:00 2001 From: Steve Downey Date: Sun, 16 Nov 2025 16:39:08 -0500 Subject: [PATCH 2/2] Add linebreaks around items Add linebreaks around newly added items in the itemize blocks. --- source/ranges.tex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/ranges.tex b/source/ranges.tex index b28f0bb4fa..ee17326a40 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -5902,6 +5902,7 @@ Otherwise, if \tcode{T} is a specialization of \tcode{optional} and \tcode{T} models \libconcept{view}, then \tcode{(static_cast(F) == D() ? ((void)E, T()) : \exposidnc{decay-copy}(E))}. + \item Otherwise, if \tcode{T} models \libconcept{random_access_range} and \libconcept{sized_range} @@ -6384,10 +6385,12 @@ then \tcode{((void)F, \exposidnc{decay-copy}(E))}, except that the evaluations of \tcode{E} and \tcode{F} are indeterminately sequenced. + \item Otherwise, if \tcode{T} is a specialization of \tcode{optional} and \tcode{T} models \libconcept{view}, then \tcode{(static_cast(F) == D() ? \exposidnc{decay-copy}(E) : ((void)E, T()))}. + \item Otherwise, if \tcode{T} models \libconcept{random_access_range} and \libconcept{sized_range} @@ -9916,9 +9919,11 @@ If the type of \tcode{E} is a (possibly cv-qualified) specialization of \tcode{reverse_view}, then \tcode{E.base()}. + \item Otherwise, if \tcode{E} is specialization of \tcode{optional} and \tcode{E} models \libconcept{view}, then \tcode{\exposidnc{decay-copy}(E)}. + \item Otherwise, if the type of \tcode{E} is \cv{} \tcode{subrange, reverse_iterator, K>} for some iterator type \tcode{I} and @@ -10070,9 +10075,11 @@ Otherwise, if \tcode{U} denotes \tcode{empty_view} for some type \tcode{X}, then \tcode{auto(views::empty)}. + \item Otherwise, if \tcode{U} denotes \tcode{optional} for some type \tcode{X}, then \tcode{optional(E)}. + \item Otherwise, if \tcode{U} denotes \tcode{span}