Need for (C++20) Contiguous Range

Steven Schveighoffer schveiguy at gmail.com
Fri Oct 9 15:44:27 UTC 2020


On 10/9/20 9:38 AM, Simen Kjærås wrote:
> On Friday, 9 October 2020 at 13:31:18 UTC, Steven Schveighoffer wrote:
>> We are talking about a range that is also contiguous in memory. The 
>> only logical reason to require this is to get a ptr and a length and 
>> use the CPU specialized instructions for these things. We have that 
>> type pattern, it's a slice.
> 
> 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.

Map over a contiguous range is going to return from the stack, not from 
the data.

A stride is not contiguous, it skips data.

I'm struggling to understand what the benefit of defining these as 
contiguous is. What can you do when defining something that isn't an 
array as contiguous memory? What are the primitives that you use, for 
what purpose?

-Steve


More information about the Digitalmars-d mailing list