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

3292. iota_view is under-constrained

Section: 25.6.4.2 [range.iota.view] Status: C++20 Submitter: Barry Revzin Opened: 2019-09-13 Last modified: 2021-02-25

Priority: Not Prioritized

View all other issues in [range.iota.view].

View all issues with C++20 status.

Discussion:

P1207R4 changed weakly_incrementable from requiring semiregular to requiring default_constructible && movable.

iota_view currently is specified to require that W be just weakly_incrementable. But we have to copy the W from the view into its iterator and also in operator*() to return a W.

The shortest resolution is just to add " && semiregular<W>" to the class constraints.

[Status to ready after discussion Friday morning in Belfast]

Proposed resolution:

This wording is relative to N4830.

  1. Modify 25.6.4.2 [range.iota.view] as indicated:

    namespace std::ranges {
      […]
      template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
        requires weakly-equality-comparable-with<W, Bound> && semiregular<W>
      class iota_view : public view_interface<iota_view<W, Bound> {
        […]
      };
      […]
    }