3773. views::zip_transform still requires F to be copy_constructible when empty pack

Section: 25.7.26.1 [range.zip.transform.overview] Status: C++23 Submitter: Hewill Kang Opened: 2022-09-12 Last modified: 2024-01-29

Priority: Not Prioritized

View all issues with C++23 status.

Discussion:

After P2494R2, range adaptors only require callable to be move_constructible, however, for views::zip_transform, when empty pack, it still requires callable to be copy_constructible. We should relax this requirement, too.

[2022-09-23; Reflector poll]

Set status to Tentatively Ready after seven votes in favour during reflector poll.

[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4910.

  1. Modify 25.7.26.1 [range.zip.transform.overview] as indicated:

    -2- The name views::zip_transform denotes a customization point object (16.3.3.3.5 [customization.point.object]). Let F be a subexpression, and let Es... be a pack of subexpressions.

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

      1. (2.1.1) — If move_constructiblecopy_constructible<FD> && 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.

      2. (2.1.2) — 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.2) — Otherwise, the expression views::zip_transform(F, Es...) is expression-equivalent to zip_transform_view(F, Es...).