Title
convertible-to-non-slicing seems to reject valid case
Status
new
Section
[range.subrange]
Submitter
S. B. Tam

Created on 2020-07-26.00:00:00 last changed 2 months ago

Messages

Date: 2020-08-15.00:00:00

[ 2020-08-21; Reflector prioritization ]

Set priority to 3 after reflector discussions.

Date: 2020-07-26.00:00:00

Consider

#include <ranges>

int main() 
{
  int a[3] = { 1, 2, 3 };
  int* b[3] = { &a[2], &a[0], &a[1] };
  auto c = std::ranges::subrange<const int*const*>(b);
}

The construction of c is ill-formed because convertible-to-non-slicing<int**, const int*const*> is false, although the conversion does not involve object slicing.

I think subrange should allow such qualification conversion, just like unique_ptr<T[]> already does.

(Given that this constraint is useful in more than one context, maybe it deserves a named type trait?)

History
Date User Action Args
2020-08-21 13:43:37adminsetmessages: + msg11440
2020-07-26 00:00:00admincreate