From cb0044930aafbadbdecf0740c0da3fa23882b564 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 10 Jun 2021 20:45:11 +0200 Subject: [PATCH] P2367R0 Remove misuses of list-initialization from Clause 24 Also fixes LWG3524. Reconciled with Motion 20 (P2210R2) to apply changes to both lazy_split_view and split_view. --- source/ranges.tex | 56 +++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/source/ranges.tex b/source/ranges.tex index 406cce5716..d9d8eb7ecb 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -1670,8 +1670,8 @@ Equivalent to: \begin{itemize} \item If \exposid{StoreSize} is \tcode{true}, -\tcode{subrange\{r, ranges::size(r)\}}. -\item Otherwise, \tcode{subrange\{ranges::begin(r), ranges::end(r)\}}. +\tcode{subrange(r, ranges::size(r))}. +\item Otherwise, \tcode{subrange(ranges::begin(r), ranges::end(r))}. \end{itemize} \end{itemdescr} @@ -1963,7 +1963,7 @@ customization point object\iref{customization.point.object}. Given a subexpression \tcode{E}, the expression \tcode{views::single(E)} is expression-equivalent to -\tcode{single_view\{E\}}. +\tcode{single_view>(E)}. \pnum \begin{example} @@ -2000,6 +2000,9 @@ constexpr T* data() noexcept; constexpr const T* data() const noexcept; }; + + template + single_view(T) -> single_view; } \end{codeblock} @@ -2101,7 +2104,7 @@ Given subexpressions \tcode{E} and \tcode{F}, the expressions \tcode{views::iota(E)} and \tcode{views::iota(E, F)} are expression-equivalent to -\tcode{iota_view\{E\}} and \tcode{iota_view\{E, F\}}, respectively. +\tcode{iota_view(E)} and \tcode{iota_view(E, F)}, respectively. \pnum \begin{example} @@ -3344,7 +3347,7 @@ range adaptor object\iref{range.adaptor.object}. Given subexpressions \tcode{E} and \tcode{P}, the expression \tcode{views::filter(E, P)} is expression-equivalent to -\tcode{filter_view\{E, P\}}. +\tcode{filter_view(E, P)}. \pnum \begin{example} @@ -3765,7 +3768,7 @@ range adaptor object\iref{range.adaptor.object}. Given subexpressions \tcode{E} and \tcode{F}, the expression \tcode{views::transform(E, F)} is expression-equivalent to -\tcode{transform_view\{E, F\}}. +\tcode{transform_view(E, F)}. \pnum \begin{example} @@ -4459,7 +4462,9 @@ \item If \tcode{T} is a specialization of \tcode{ranges::empty_view}\iref{range.empty.view}, -then \tcode{((void) F, \placeholdernc{decay-copy}(E))}. +then \tcode{((void) F, \placeholdernc{decay-copy}(E))}, +except that the evaluations of \tcode{E} and \tcode{F} +are indeterminately sequenced. \item Otherwise, if \tcode{T} models @@ -4471,11 +4476,11 @@ \item a specialization of \tcode{ranges::iota_view}\iref{range.iota.view}, or \item a specialization of \tcode{ranges::subrange}\iref{range.subrange}, \end{itemize} -then \tcode{T\{ranges::begin(E), ranges::begin(E) + min(ranges::size(E), F)\}}, +then \tcode{T(ranges::begin(E), ranges::begin(E) + min(ranges::size(E), F))}, except that \tcode{E} is evaluated only once. \item -Otherwise, \tcode{ranges::take_view\{E, F\}}. +Otherwise, \tcode{ranges::take_view(E, F)}. \end{itemize} \pnum @@ -4517,10 +4522,10 @@ return ranges::begin(@\exposid{base_}@); else { auto sz = size(); - return counted_iterator{ranges::begin(@\exposid{base_}@), sz}; + return counted_iterator(ranges::begin(@\exposid{base_}@), sz); } } else - return counted_iterator{ranges::begin(@\exposid{base_}@), @\exposid{count_}@}; + return counted_iterator(ranges::begin(@\exposid{base_}@), @\exposid{count_}@); } constexpr auto begin() const requires @\libconcept{range}@ { @@ -4529,10 +4534,10 @@ return ranges::begin(@\exposid{base_}@); else { auto sz = size(); - return counted_iterator{ranges::begin(@\exposid{base_}@), sz}; + return counted_iterator(ranges::begin(@\exposid{base_}@), sz); } } else - return counted_iterator{ranges::begin(@\exposid{base_}@), @\exposid{count_}@}; + return counted_iterator(ranges::begin(@\exposid{base_}@), @\exposid{count_}@); } constexpr auto end() requires (!@\exposconcept{simple-view}@) { @@ -4680,7 +4685,7 @@ a range adaptor object\iref{range.adaptor.object}. Given subexpressions \tcode{E} and \tcode{F}, the expression \tcode{views::take_while(E, F)} -is expression-equivalent to \tcode{take_while_view\{E, F\}}. +is expression-equivalent to \tcode{take_while_view(E, F)}. \pnum \begin{example} @@ -4868,7 +4873,9 @@ \item If \tcode{T} is a specialization of \tcode{ranges::empty_view}\iref{range.empty.view}, -then \tcode{((void) F, \placeholdernc{decay-copy}(E))}. +then \tcode{((void) F, \placeholdernc{decay-copy}(E))}, +except that the evaluations of \tcode{E} and \tcode{F} +are indeterminately sequenced. \item Otherwise, if \tcode{T} models @@ -4880,11 +4887,11 @@ \item a specialization of \tcode{ranges::iota_view}\iref{range.iota.view}, or \item a specialization of \tcode{ranges::subrange}\iref{range.subrange}, \end{itemize} -then \tcode{T\{ranges::begin(E) + min(ranges::size(E), F), ranges::end(E)\}}, +then \tcode{T(ranges::begin(E) + min(ranges::size(E), F), ranges::end(E))}, except that \tcode{E} is evaluated only once. \item -Otherwise, \tcode{ranges::drop_view\{E, F\}}. +Otherwise, \tcode{ranges::drop_view(E, F)}. \end{itemize} \pnum @@ -5013,7 +5020,7 @@ denotes a range adaptor object\iref{range.adaptor.object}. Given subexpressions \tcode{E} and \tcode{F}, the expression \tcode{views::drop_while(E, F)} -is expression-equivalent to \tcode{drop_while_view\{E, F\}}. +is expression-equivalent to \tcode{drop_while_view(E, F)}. \pnum \begin{example} @@ -5613,7 +5620,7 @@ range adaptor object\iref{range.adaptor.object}. Given subexpressions \tcode{E} and \tcode{F}, the expression \tcode{views::lazy_split(E, F)} is expression-equivalent to -\tcode{lazy_split_view\{E, F\}}. +\tcode{lazy_split_view(E, F)}. \pnum \begin{example} @@ -5730,7 +5737,7 @@ \pnum \effects Initializes \exposid{base_} with \tcode{views::all(std::forward(r))}, and -\exposid{pattern_} with \tcode{single_view\{\brk{}std::move(e)\}}. +\exposid{pattern_} with \tcode{views::\linebreak single(std::move(e))}. \end{itemdescr} \rSec3[range.lazy.split.outer]{Class template \tcode{lazy_split_view::\exposid{outer-iterator}}} @@ -6238,6 +6245,7 @@ \exposid{pattern_} with \tcode{std::move(pattern)}. \end{itemdescr} +\indexlibraryctor{split_view}% \begin{itemdecl} template<@\libconcept{forward_range}@ R> requires @\libconcept{constructible_from}@> && @@ -6249,7 +6257,7 @@ \pnum \effects Initializes \exposid{base_} with \tcode{views::all(std::forward(r))}, and -\exposid{pattern_} with \tcode{single_view\{std::move(e)\}}. +\exposid{pattern_} with \tcode{views::\linebreak single(std::move(e))}. \end{itemdescr} \begin{itemdecl} @@ -6475,16 +6483,16 @@ \begin{itemize} \item If \tcode{T} models \libconcept{contiguous_iterator}, -then \tcode{span\{to_address(E), static_cast(F)\}}. +then \tcode{span(to_address(E), static_cast(F))}. \item Otherwise, if \tcode{T} models \libconcept{random_access_iterator}, -then \tcode{subrange\{E, E + static_cast(F)\}}, +then \tcode{subrange(E, E + static_cast(F))}, except that \tcode{E} is evaluated only once. \item Otherwise, -\tcode{subrange\{counted_iterator\{E, F\}, default_sentinel\}}. +\tcode{subrange(counted_iterator(E, F), default_sentinel)}. \end{itemize} \rSec2[range.common]{Common view}