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.

3946. The definition of const_iterator_t should be reworked

Section: 25.2 [ranges.syn] Status: WP Submitter: Christopher Di Bella Opened: 2023-06-13 Last modified: 2023-11-22

Priority: Not Prioritized

View all other issues in [ranges.syn].

View all issues with WP status.

Discussion:

During the reflector discussion of P2836, consensus was reached that const_iterator_t<R> doesn't necessarily provide the same type as decltype(ranges::cbegin(r)), and that it should be changed to the proposed resolution below so that they're consistent.

[Varna 2023-06-14; Move to Ready]

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

Proposed resolution:

This wording is relative to N4950.

  1. Modify 25.2 [ranges.syn], header <ranges> synopsis, as indicated:

    […]
    template<range R>
      using const_iterator_t = decltype(ranges::cbegin(declval<R&>()))const_iterator<iterator_t<R>>; // freestanding
    template<range R>
      using const_sentinel_t = decltype(ranges::cend(declval<R&>()))const_sentinel<sentinel_t<R>>;   // freestanding
    […]