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

Created on 2023-01-24.00:00:00 last changed 12 months ago

Messages

Date: 2023-02-13.10:17:57

Proposed resolution:

This wording is relative to N4928.

  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<range R>
        using range_reference_t = iter_reference_t<iterator_t<R>>;                      // freestanding
      template<range R>
        using range_const_reference_t = iter_const_reference_t<iterator_t<R>>;          // freestanding
      template<range R>
        using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<R>>;        // freestanding
      template<range R>
        using range_common_reference_t = iter_common_reference_t<iterator_t<R>>;        // freestanding
      […]
    }
    
Date: 2023-02-13.00:00:00

[ 2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Voting → WP. ]

Date: 2023-02-15.00:00:00

[ 2023-02-06; Reflector poll ]

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

Date: 2023-01-24.00:00:00

For the alias template iter_meow_t in <iterator>, there are almost all corresponding range_meow_t in <ranges>, except for iter_common_reference_t, which is used to calculate the common reference type shared by reference and value_type of the iterator.

Given that it has a highly similar formula form to iter_const_reference_t, and the latter has a corresponding sibling, I think we should add a range_common_reference_t for <ranges>.

This increases the consistency of the two libraries and simplifies the text of getting common reference from a range. Since C++23 brings proxy iterators and tuple enhancements, I believe such introduction can bring some value.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2023-02-13 10:17:57adminsetmessages: + msg13374
2023-02-13 10:17:57adminsetstatus: voting -> wp
2023-02-06 15:33:48adminsetstatus: ready -> voting
2023-02-06 15:13:50adminsetmessages: + msg13266
2023-02-06 15:13:50adminsetstatus: new -> ready
2023-01-28 12:54:17adminsetmessages: + msg13221
2023-01-24 00:00:00admincreate