Need for (C++20) Contiguous Range

Steven Schveighoffer schveiguy at gmail.com
Fri Oct 9 16:05:09 UTC 2020


On 10/9/20 11:47 AM, Ola Fosheim Grøstad wrote:
> On Friday, 9 October 2020 at 15:44:27 UTC, Steven Schveighoffer wrote:
>> 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?
> 
> All kinds of numerics. Like, getting the real parts from a complex set 
> and use an algorithm that has been defined on reals only.

So basically, a contiguous primitive might be ptr, distance between 
elements, and total elements? And this is something you can plug into a 
low-level API? I can see that being a possibility, but also the 
underlying type has to be an array anyway.

I don't know that we would have to define a range primitive for this. 
Just a set of operations on an array of data, with parameters for the 
other pieces.

-Steve


More information about the Digitalmars-d mailing list