Skip to content

P2367R0 Remove misuses of list-initialization from Clause 24 #4685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 32 additions & 24 deletions source/ranges.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down Expand Up @@ -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<decay_t<decltype((E))>>(E)}.

\pnum
\begin{example}
Expand Down Expand Up @@ -2000,6 +2000,9 @@
constexpr T* data() noexcept;
constexpr const T* data() const noexcept;
};

template<class T>
single_view(T) -> single_view<T>;
}
\end{codeblock}

Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand All @@ -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<D>(ranges::size(E), F)\}},
then \tcode{T(ranges::begin(E), ranges::begin(E) + min<D>(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
Expand Down Expand Up @@ -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}@<const V> {
Expand All @@ -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}@<V>) {
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand All @@ -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<D>(ranges::size(E), F), ranges::end(E)\}},
then \tcode{T(ranges::begin(E) + min<D>(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
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -5730,7 +5737,7 @@
\pnum
\effects
Initializes \exposid{base_} with \tcode{views::all(std::forward<R>(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}}}
Expand Down Expand Up @@ -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}@<V, views::all_t<R>> &&
Expand All @@ -6249,7 +6257,7 @@
\pnum
\effects
Initializes \exposid{base_} with \tcode{views::all(std::forward<R>(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}
Expand Down Expand Up @@ -6475,16 +6483,16 @@
\begin{itemize}
\item
If \tcode{T} models \libconcept{contiguous_iterator},
then \tcode{span\{to_address(E), static_cast<D>(F)\}}.
then \tcode{span(to_address(E), static_cast<D>(F))}.

\item
Otherwise, if \tcode{T} models \libconcept{random_access_iterator},
then \tcode{subrange\{E, E + static_cast<D>(F)\}},
then \tcode{subrange(E, E + static_cast<D>(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}
Expand Down