Files
2025-10-25 03:02:53 +03:00

2.2 KiB
Raw Permalink Blame History

[range.zip.transform.overview]

25 Ranges library [ranges]

25.7 Range adaptors [range.adaptors]

25.7.26 Zip transform view [range.zip.transform]

25.7.26.1 Overview [range.zip.transform.overview]

1

#

zip_transform_view takes an invocable object and any number of views and produces a view whose Mth element is the result of applying the invocable object to the Mth elements of all views.

2

#

The name views::zip_transform denotes a customization point object ([customization.point.object]).

Let F be a subexpression, and let Es... be a pack of subexpressions.

  • (2.1)

    If Es is an empty pack, let FD be decay_t<decltype((F))>.

If move_constructible &&regular_invocable<FD&> is false, or if decay_t<invoke_result_t<FD&>> is not an object type,views::zip_transform(F, Es...) is ill-formed.

Otherwise, the expression views::zip_transform(F, Es...) is expression-equivalent to((void)F, auto(views::empty<decay_t<invoke_result_t<FD&>>>))

  • (2.2)

    Otherwise, the expression views::zip_transform(F, Es...) is expression-equivalent to zip_transform_view(F, Es...).

3

#

[Example 1: vector v1 = {1, 2}; vector v2 = {4, 5, 6};

for (auto i : views::zip_transform(plus(), v1, v2)) { cout << i << ' '; // prints 5 7} — end example]