Need for (C++20) Contiguous Range

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Oct 8 14:55:40 UTC 2020


On Thursday, 8 October 2020 at 14:45:47 UTC, Steven Schveighoffer 
wrote:
> We have arrays in D, there is no need to duplicate what C++ 
> does because they don't have a real array type.

std::array and std::vector are array types, but the concept of 
being contiguous applies to all containers, also third party.

> In D, you would check if the range is a dynamic array, and then 
> use ptr/length to deal with optimizations (I do this in iopipe).

ok, if all custom containers with a linear buffer provides the 
same pointer interface then that would work like data().

But I think the c++ solution is too weak. It does not work with 
deques, btrees etc... :-/





More information about the Digitalmars-d mailing list