This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.

4096. views::iota(views::iota(0)) should be rejected

Section: 26.6.4.1 [range.iota.overview] Status: WP Submitter: Hewill Kang Opened: 2024-05-08 Last modified: 2024-07-08

Priority: Not Prioritized

View all issues with WP status.

Discussion:

views::iota(E) literally means incrementing element E endlessly, but views::iota(views::iota(0)) is currently well-formed due to CTAD, rejecting such unreasonable spelling seems therefore reasonable.

[2024-06-24; Reflector poll]

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

[St. Louis 2024-06-29; Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4981.

  1. Modify 26.6.4.1 [range.iota.overview] as indicated:

    -1- iota_view generates a sequence of elements by repeatedly incrementing an initial value.

    -2- The name views::iota denotes a customization point object (16.3.3.3.5 [customization.point.object]). Given subexpressions E and F, the expressions views::iota(E) and views::iota(E, F) are expression-equivalent to iota_view<decay_t<decltype((E))>>(E) and iota_view(E, F), respectively.