Title
has-tuple-element helper concept needs convertible_to
Status
c++20
Section
[range.elements.view]
Submitter
Great Britain

Created on 2019-11-06.00:00:00 last changed 38 months ago

Messages

Date: 2019-11-07.08:02:35

Proposed resolution:

This wording is relative to N4835.

  1. Modify [range.elements.view], class template elements_view synopsis, as indicated:

    namespace std::ranges {
      template<class T, size_t N>
      concept has-tuple-element = // exposition only
        requires(T t) {
          typename tuple_size<T>::type;
          requires N < tuple_size_v<T>;
          typename tuple_element_t<N, T>;
          { get<N>(t) } -> convertible_to<const tuple_element_t<N, T>&>;
        };
    […]
    }
    
Date: 2019-11-07.08:02:35

[ 2019-11 Status to Ready during Wednesday night issue processing in Belfast. ]

Date: 2019-11-06.00:00:00

Addresses GB 299

has-tuple-element helper concept needs convertible_to

The exposition-only has-tuple-element concept (for elements_view) is defined as

template<class T, size_t N>
concept has-tuple-element = exposition only
  requires(T t) {
    typename tuple_size<T>::type;
    requires N < tuple_size_v<T>;
    typename tuple_element_t<N, T>;
    { get<N>(t) } -> const tuple_element_t<N, T>&;
  };

However, the return type constraint for { get<N>(t) } is no longer valid under the latest concepts changes

Proposed change:

Change to:

template<class T, size_t N>
concept has-tuple-element = exposition only
  requires(T t) {
    typename tuple_size<T>::type;
    requires N < tuple_size_v<T>;
    typename tuple_element_t<N, T>;
    { get<N>(t) } -> convertible_to<const tuple_element_t<N, T>&>;
  };

Jonathan Wakely:

The NB comment says "The return type constraint for { get(t) } is no longer valid under the latest concepts changes." The changes referred to are those in P1452R2.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: voting -> wp
2020-01-17 04:54:50adminsetstatus: ready -> voting
2019-11-07 08:02:35adminsetmessages: + msg10774
2019-11-07 08:02:35adminsetstatus: new -> ready
2019-11-06 19:37:45adminsetmessages: + msg10762
2019-11-06 00:00:00admincreate