std::ranges::views::zip_transform, std::ranges::zip_transform_view
Defined in header <ranges>
|
||
template< std::copy_constructible F, ranges::input_range... Views > requires (ranges::view<Views> && ...) && (sizeof...(Views) > 0) && |
(1) | (since C++23) |
namespace views { inline constexpr /*unspecified*/ zip_transform = /*unspecified*/; |
(2) | (since C++23) |
Call signature |
||
template< class F, ranges::viewable_range... Rs > requires /* see below */ |
(since C++23) | |
zip_transform_view
is a range adaptor that takes a invocable object and one or more view
s, and produces a view
whose i
th element is the result of applying the invocable object to the i
th elements of all views.A type
T
models the exposition-only concept can-reference
if and only if T& is a valid type.views::zip_transform
is a customization point object.
When calling with one argument f, let FD
be std::decay_t<decltype(f)>, if:
-
FD
modelscopy_constructible
, - FD& models
regular_invocable
, and - std::invoke_result_t<FD&> is an object type,
then views::zip_transform(f) is expression-equivalent to ((void)f, auto(views::empty<std::decay_t<std::invoke_result_t<FD&>>>)). Otherwise, the call to views::zip_transform
is ill-formed.
zip_transform_view
models the concepts random_access_range
, bidirectional_range
, forward_range
, input_range
, common_range
, and sized_range
when the underlying ranges::zip_view<Views...> models respective concepts.
Contents |
Customization point objects
The name views::zip_transform
denotes a customization point object, which is a const function object of a literal semiregular
class type. For exposition purposes, the cv-unqualified version of its type is denoted as __zip_transform_fn
.
All instances of __zip_transform_fn
are equal. The effects of invoking different instances of type __zip_transform_fn
on the same arguments are equivalent, regardless of whether the expression denoting the instance is an lvalue or rvalue, and is const-qualified or not (however, a volatile-qualified instance is not required to be invocable). Thus, views::zip_transform
can be copied freely and its copies can be used interchangeably.
Given a set of types Args...
, if std::declval<Args>()... meet the requirements for arguments to views::zip_transform
above, __zip_transform_fn
models
- std::invocable<__zip_transform_fn, Args...>,
- std::invocable<const __zip_transform_fn, Args...>,
- std::invocable<__zip_transform_fn&, Args...>, and
- std::invocable<const __zip_transform_fn&, Args...>.
Otherwise, no function call operator of __zip_transform_fn
participates in overload resolution.
Expression-equivalent
Expression e is expression-equivalent to expression f, if
- e and f have the same effects, and
- either both are constant subexpressions or else neither is a constant subexpression, and
- either both are potentially-throwing or else neither is potentially-throwing (i.e. noexcept(e) == noexcept(f)).
Data members
Typical implementation of zip_transform_view
hold two non-static data members:
- a underlying view object of type ranges::zip_view<Views...> (shown here as
zip_
for exposition only), and - a wrapped invocable object of type copyable-box
<F>
(shown here asfun_
for exposition only).
Member functions
constructs a zip_transform_view (public member function) | |
returns an iterator to the beginning (public member function) | |
returns an iterator or a sentinel to the end (public member function) | |
returns the number of elements. Provided only if each underlying (adapted) range satisfies sized_range . (public member function) | |
Inherited from std::ranges::view_interface | |
returns whether the derived view is empty. Provided if it satisfies sized_range or forward_range . (public member function of std::ranges::view_interface<D> )
| |
(C++23) |
returns a constant iterator to the beginning of the range. (public member function of std::ranges::view_interface<D> )
|
(C++23) |
returns a sentinel for the constant iterator of the range. (public member function of std::ranges::view_interface<D> )
|
returns whether the derived view is not empty. Provided if ranges::empty is applicable to it. (public member function of std::ranges::view_interface<D> )
| |
returns the first element in the derived view. Provided if it satisfies forward_range . (public member function of std::ranges::view_interface<D> )
| |
returns the last element in the derived view. Provided if it satisfies bidirectional_range and common_range . (public member function of std::ranges::view_interface<D> )
| |
returns the n th element in the derived view. Provided if it satisfies random_access_range . (public member function of std::ranges::view_interface<D> )
|
Deduction guides
Nested classes
(C++23) |
the iterator type (exposition-only member class template*) |
(C++23) |
the sentinel type used when the underlying zip_view is not a common_range (exposition-only member class template*) |
Example
This section is incomplete Reason: no example |
See also
(C++23) |
a view consisting of tuples of references to corresponding elements of the adapted views(class template) (customization point object) |
a view of a sequence that applies a transformation function to each element(class template) (range adaptor object) |