Need for (C++20) Contiguous Range

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri Oct 9 15:14:19 UTC 2020


On Friday, 9 October 2020 at 13:38:28 UTC, Simen Kjærås wrote:
> There are ranges with contiguous memory that aren't slices - 
> stride and occasionally map over a contiguous range comes to 
> mind. Converting these to slices may not be possible, and 
> certainly not efficient.

I guess it in some cases would be technically possible to emulate 
fixed stride with a recast to a slice of a struct with padding 
before and after the element you want.

But not very clean.

Microsoft's experimental gsl::span implementation did support 
strides, but I don't think that is possible with the std::span 
that ended up in the standard.  (C++ span is similar to D slices)


More information about the Digitalmars-d mailing list