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

3670. Cpp17InputIterators don't have integer-class difference types

Section: 25.6.4.3 [range.iota.iterator] Status: C++23 Submitter: Casey Carter Opened: 2022-02-04 Last modified: 2023-11-22

Priority: Not Prioritized

View other active issues in [range.iota.iterator].

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

View all issues with C++23 status.

Discussion:

25.6.4.3 [range.iota.iterator] defines

using iterator_category = input_iterator_tag; // present only if W models incrementable

but when difference_type is an integer-class type the iterator does not meet the Cpp17InputIterator requirements.

[2022-02-07; Daniel comments]

As requested by LWG 3376(i) and wording implemented by P2393R1, integer-class types are no longer required to have class type.

Previous resolution [SUPERSEDED]:

This wording is relative to N4901.

  1. Modify 25.6.4.3 [range.iota.iterator], class iota_view::iterator synopsis, as indicated:

    namespace std::ranges {
      template<weakly_incrementable W, semiregular Bound>
        requires weakly-equality-comparable-with<W, Bound> && copyable<W>
      struct iota_view<W, Bound>::iterator {
        […]
        using iterator_category = input_iterator_tag; // present only if W models incrementable and 
                                                      // IOTA-DIFF-T(W) is not a class type
        using value_type = W;
        using difference_type = IOTA-DIFF-T(W);
        […]
      };
    }
    

[2022-02-07; Casey Carter provides improved wording]

[2022-03-04; Reflector poll]

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

[2022-07-15; LWG telecon: move to Ready]

[2022-07-25 Approved at July 2022 virtual plenary. Status changed: Ready → WP.]

Proposed resolution:

This wording is relative to N4901.

  1. Modify 25.6.4.3 [range.iota.iterator], class iota_view::iterator synopsis, as indicated:

    namespace std::ranges {
      template<weakly_incrementable W, semiregular Bound>
        requires weakly-equality-comparable-with<W, Bound> && copyable<W>
      struct iota_view<W, Bound>::iterator {
        […]
        using iterator_category = input_iterator_tag; // present only if W models incrementable and 
                                                      // IOTA-DIFF-T(W) is an integral type
        using value_type = W;
        using difference_type = IOTA-DIFF-T(W);
        […]
      };
    }