|
2038 | 2038 | constexpr explicit iota_view(W value);
|
2039 | 2039 | constexpr iota_view(type_identity_t<W> value,
|
2040 | 2040 | type_identity_t<Bound> bound);
|
| 2041 | + constexpr iota_view(@\exposid{iterator}@ first, @\exposid{sentinel}@ last) : iota_view(*first, last.@\exposid{bound_}@) {} |
2041 | 2042 |
|
2042 | 2043 | constexpr @\exposid{iterator}@ begin() const;
|
2043 | 2044 | constexpr auto end() const;
|
|
2048 | 2049 |
|
2049 | 2050 | template<class W, class Bound>
|
2050 | 2051 | requires (!@\exposconcept{is-integer-like}@<W> || !@\exposconcept{is-integer-like}@<Bound> ||
|
2051 |
| - (@\exposconcept{is-signed-integer-like}@<W> == @\exposconcept{is-signed-integer-like}@<Bound>)) |
| 2052 | + (@\exposconcept{is-signed-integer-like}@<W> == @\exposconcept{is-signed-integer-like}@<Bound>)) |
2052 | 2053 | iota_view(W, Bound) -> iota_view<W, Bound>;
|
2053 | 2054 | }
|
2054 | 2055 | \end{codeblock}
|
|
4206 | 4207 | \pnum
|
4207 | 4208 | The name \tcode{views::take} denotes a
|
4208 | 4209 | range adaptor object\iref{range.adaptor.object}.
|
4209 |
| -Given subexpressions \tcode{E} and \tcode{F}, the expression |
4210 |
| -\tcode{views::take(E, F)} is expression-equivalent to |
4211 |
| -\tcode{take_view\{E, F\}}. |
| 4210 | +Let \tcode{E} and \tcode{F} be expressions, |
| 4211 | +let \tcode{T} be \tcode{remove_cvref_t<decltype((E))>}, and |
| 4212 | +let \tcode{D} be \tcode{range_difference_t<decltype((E))>}. |
| 4213 | +If \tcode{decltype((F))} does not model |
| 4214 | +\tcode{\libconcept{convertible_to}<D>}, |
| 4215 | +\tcode{views::take(E, F)} is ill-formed. |
| 4216 | +Otherwise, the expression \tcode{views::take(E, F)} |
| 4217 | +is expression-equivalent to: |
| 4218 | + |
| 4219 | +\begin{itemize} |
| 4220 | +\item |
| 4221 | +If \tcode{T} is a specialization |
| 4222 | +of \tcode{ranges::empty_view}\iref{range.empty.view}, |
| 4223 | +then \tcode{((void) F, \placeholdernc{decay-copy}(E))}. |
| 4224 | + |
| 4225 | +\item |
| 4226 | +Otherwise, if \tcode{T} models |
| 4227 | +\libconcept{random_access_range} and \libconcept{sized_range} |
| 4228 | +and is |
| 4229 | +\begin{itemize} |
| 4230 | +\item a specialization of \tcode{span}\iref{views.span} where \tcode{T::extent == dynamic_extent}, |
| 4231 | +\item a specialization of \tcode{basic_string_view}\iref{string.view}, |
| 4232 | +\item a specialization of \tcode{ranges::iota_view}\iref{range.iota.view}, or |
| 4233 | +\item a specialization of \tcode{ranges::subrange}\iref{range.subrange}, |
| 4234 | +\end{itemize} |
| 4235 | +then \tcode{T\{ranges::begin(E), ranges::begin(E) + min<D>(ranges::size(E), F)\}}, |
| 4236 | +except that \tcode{E} is evaluated only once. |
| 4237 | + |
| 4238 | +\item |
| 4239 | +Otherwise, \tcode{ranges::take_view\{E, F\}}. |
| 4240 | +\end{itemize} |
4212 | 4241 |
|
4213 | 4242 | \pnum
|
4214 | 4243 | \begin{example}
|
|
4560 | 4589 | \pnum
|
4561 | 4590 | The name \tcode{views::drop} denotes
|
4562 | 4591 | a range adaptor object\iref{range.adaptor.object}.
|
4563 |
| -Given subexpressions \tcode{E} and \tcode{F}, |
4564 |
| -the expression \tcode{views::drop(E, F)} |
4565 |
| -is expression-equivalent to \tcode{drop_view\{E, F\}}. |
| 4592 | +Let \tcode{E} and \tcode{F} be expressions, |
| 4593 | +let \tcode{T} be \tcode{remove_cvref_t<decltype((E))>}, and |
| 4594 | +let \tcode{D} be \tcode{range_difference_t<decltype((E))>}. |
| 4595 | +If \tcode{decltype((F))} does not model |
| 4596 | +\tcode{\libconcept{convertible_to}<D>}, |
| 4597 | +\tcode{views::drop(E, F)} is ill-formed. |
| 4598 | +Otherwise, the expression \tcode{views::drop(E, F)} |
| 4599 | +is expression-equivalent to: |
| 4600 | + |
| 4601 | +\begin{itemize} |
| 4602 | +\item |
| 4603 | +If \tcode{T} is a specialization of |
| 4604 | +\tcode{ranges::empty_view}\iref{range.empty.view}, |
| 4605 | +then \tcode{((void) F, \placeholdernc{decay-copy}(E))}. |
| 4606 | + |
| 4607 | +\item |
| 4608 | +Otherwise, if \tcode{T} models |
| 4609 | +\libconcept{random_access_range} and \libconcept{sized_range} |
| 4610 | +and is |
| 4611 | +\begin{itemize} |
| 4612 | +\item a specialization of \tcode{span}\iref{views.span} where \tcode{T::extent == dynamic_extent}, |
| 4613 | +\item a specialization of \tcode{basic_string_view}\iref{string.view}, |
| 4614 | +\item a specialization of \tcode{ranges::iota_view}\iref{range.iota.view}, or |
| 4615 | +\item a specialization of \tcode{ranges::subrange}\iref{range.subrange}, |
| 4616 | +\end{itemize} |
| 4617 | +then \tcode{T\{ranges::begin(E) + min<D>(ranges::size(E), F), ranges::end(E)\}}, |
| 4618 | +except that \tcode{E} is evaluated only once. |
| 4619 | + |
| 4620 | +\item |
| 4621 | +Otherwise, \tcode{ranges::drop_view\{E, F\}}. |
| 4622 | +\end{itemize} |
4566 | 4623 |
|
4567 | 4624 | \pnum
|
4568 | 4625 | \begin{example}
|
|
5773 | 5830 | for an iterator \tcode{i} and non-negative integer \tcode{n}.
|
5774 | 5831 |
|
5775 | 5832 | \pnum
|
5776 |
| -The name \tcode{views::counted} denotes a |
5777 |
| -customization point object\iref{customization.point.object}. |
| 5833 | +The name \tcode{views::counted} denotes |
| 5834 | +a customization point object\iref{customization.point.object}. |
5778 | 5835 | Let \tcode{E} and \tcode{F} be expressions,
|
5779 |
| -and let \tcode{T} be \tcode{decay_t<decltype((E))>}. |
5780 |
| -Then the expression \tcode{views::counted(E, F)} is expression-equivalent to: |
| 5836 | +let \tcode{T} be \tcode{decay_t<decltype((E))>}, and |
| 5837 | +let \tcode{D} be \tcode{iter_difference_t<T>}. |
| 5838 | +If \tcode{decltype((F))} does not model |
| 5839 | +\tcode{\libconcept{convertible_to}<D>}, |
| 5840 | +\tcode{views::counted(E, F)} is ill-formed. |
| 5841 | +\begin{note} |
| 5842 | +This case can result in substitution failure |
| 5843 | +when \tcode{views::counted(E, F)} |
| 5844 | +appears in the immediate context of a template instantiation. |
| 5845 | +\end{note} |
| 5846 | +Otherwise, \tcode{views::counted(E, F)} |
| 5847 | +is expression-equivalent to: |
| 5848 | + |
5781 | 5849 | \begin{itemize}
|
5782 |
| -\item If \tcode{T} models \libconcept{input_or_output_iterator} and |
5783 |
| - \tcode{decltype((F))} models \tcode{\libconcept{convertible_to}<iter_differ\-ence_t<T>>}, |
5784 |
| - \begin{itemize} |
5785 |
| - \item \tcode{subrange\{E, E + static_cast<iter_difference_t<T>>(F)\}} |
5786 |
| - if \tcode{T} models \libconceptx{random_access_\-it\-er\-ator}{random_access_iterator}. |
5787 |
| - \item Otherwise, |
5788 |
| - \tcode{subrange\{counted_iterator\{E, F\}, default_sentinel\}}. |
5789 |
| -\end{itemize} |
| 5850 | +\item |
| 5851 | +If \tcode{T} models \libconcept{contiguous_iterator}, |
| 5852 | +then \tcode{span\{to_address(E), static_cast<D>(F)\}}. |
5790 | 5853 |
|
5791 |
| -\item Otherwise, \tcode{views::counted(E, F)} is ill-formed. |
5792 |
| - \begin{note} |
5793 |
| - This case can result in substitution failure when \tcode{views::counted(E, F)} |
5794 |
| - appears in the immediate context of a template instantiation. |
5795 |
| - \end{note} |
| 5854 | +\item |
| 5855 | +Otherwise, if \tcode{T} models \libconcept{random_access_iterator}, |
| 5856 | +then \tcode{subrange\{E, E + static_cast<D>(F)\}}, |
| 5857 | +except that \tcode{E} is evaluated only once. |
| 5858 | + |
| 5859 | +\item |
| 5860 | +Otherwise, |
| 5861 | +\tcode{subrange\{counted_iterator\{E, F\}, default_sentinel\}}. |
5796 | 5862 | \end{itemize}
|
5797 | 5863 |
|
5798 | 5864 | \rSec2[range.common]{Common view}
|
|
0 commit comments