Title
std::tuple_element_t<std::ranges::subrange<I, S, K>> should remove top-level cv-qualifiers
Status
new
Section
[ranges.syn]
Submitter
Jiang An

Created on 2022-06-30.00:00:00 last changed 28 months ago

Messages

Date: 2022-07-08.20:04:38

Proposed resolution:

This wording is relative to N4910.

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

    […]
    namespace std {
      […]
      
      template<class I, class S, ranges::subrange_kind K>
      struct tuple_element<0, ranges::subrange<I, S, K>> {
        using type = remove_cv_t<I>;
      };
      template<class I, class S, ranges::subrange_kind K>
      struct tuple_element<1, ranges::subrange<I, S, K>> {
        using type = remove_cv_t<S>;
      };
      template<class I, class S, ranges::subrange_kind K>
      struct tuple_element<0, const ranges::subrange<I, S, K>> {
        using type = remove_cv_t<I>;
      };
      template<class I, class S, ranges::subrange_kind K>
      struct tuple_element<1, const ranges::subrange<I, S, K>> {
        using type = remove_cv_t<S>;
      };
    }
    […]
    
Date: 2022-07-15.00:00:00

[ 2022-07-08; Reflector poll ]

Set priority to 4 after reflector poll. "This is just contrived, especially since lots of the iterator requirements on such a type involve deprecated operations."

Date: 2022-06-30.00:00:00

std::ranges::subrange<int * volatile>> is weird but valid. The return type (deduced type for auto) of std::ranges::get for this type is int*, because the replacing of that (cv-unqualified) auto drops top-level cv-qualifiers. I think get is doing the right thing, and std::tuple_element_t should be consistent with the return types.

History
Date User Action Args
2022-07-08 20:04:38adminsetmessages: + msg12567
2022-07-03 12:37:52adminsetmessages: + msg12548
2022-06-30 00:00:00admincreate