Title
const_sentinel_t is missing
Status
c++23
Section
[ranges.syn]
Submitter
Hewill Kang

Created on 2022-09-05.00:00:00 last changed 13 months ago

Messages

Date: 2022-11-17.00:42:33

Proposed resolution:

This wording is relative to n4917.

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

    #include <compare>              // see [compare.syn]
    #include <initializer_list>     // see [initializer.list.syn]
    #include <iterator>             // see [iterator.synopsis]
    
    namespace std::ranges {
      […]
      template<class T>
        using iterator_t = decltype(ranges::begin(declval<T&>()));                      // freestanding
      template<range R>
        using sentinel_t = decltype(ranges::end(declval<R&>()));                        // freestanding
      template<range R>
        using const_iterator_t = const_iterator<iterator_t<R>>;                         // freestanding
      template<range R>
        using const_sentinel_t = const_sentinel<sentinel_t<R>>;                         // freestanding
      […]
    }
    
Date: 2022-11-12.00:00:00

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

Date: 2022-10-15.00:00:00

[ 2022-10-12; Reflector poll ]

Set status to "Tentatively Ready" after seven votes in favour.

Date: 2022-09-15.00:00:00

[ 2022-09-25; Daniel and Hewill provide alternative wording ]

The alternative solution solely adds the suggested const_sentinel_t alias template and doesn't touch the const_iterator_t constraints.

Date: 2022-09-15.00:00:00

[ 2022-09-23; Reflector poll ]

Set priority to 3 after reflector poll.

Comment from a reviewer:

"I don't see why we should redundantly constrain const_iterator_t with input_range; it's not as if we can make it more ill-formed or more SFINAE-friendly than it is now."

Previous resolution [SUPERSEDED]:

This wording is relative to n4917.

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

    #include <compare>              // see [compare.syn]
    #include <initializer_list>     // see [initializer.list.syn]
    #include <iterator>             // see [iterator.synopsis]
    
    namespace std::ranges {
      […]
      template<class T>
        using iterator_t = decltype(ranges::begin(declval<T&>()));                      // freestanding
      template<range R>
        using sentinel_t = decltype(ranges::end(declval<R&>()));                        // freestanding
      template<input_range R>
        using const_iterator_t = const_iterator<iterator_t<R>>;                         // freestanding
      template<range R>
        using const_sentinel_t = const_sentinel<sentinel_t<R>>;                         // freestanding
      […]
    }
    
Date: 2022-09-05.00:00:00

The type alias pair const_iterator and const_sentinel and the factory function pair make_const_iterator and make_const_sentinel are defined in <iterator>, however, only const_iterator_t exists in <ranges>, which lacks const_sentinel_t, we should add it to ensure consistency.

The proposed resolution also lifts the type constraint of const_iterator_t to input_range to make it consistent with const_iterator, which already requires that its template parameter must model input_iterator.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2022-11-17 00:42:33adminsetmessages: + msg13072
2022-11-17 00:42:33adminsetstatus: voting -> wp
2022-11-08 03:46:49adminsetstatus: ready -> voting
2022-10-12 14:38:10adminsetmessages: + msg12851
2022-10-12 14:38:10adminsetstatus: new -> ready
2022-09-25 06:26:12adminsetmessages: + msg12807
2022-09-23 15:44:07adminsetmessages: + msg12803
2022-09-08 08:31:01adminsetmessages: + msg12755
2022-09-05 00:00:00admincreate