Need for (C++20) Contiguous Range

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


On Thursday, 8 October 2020 at 14:18:45 UTC, Ola Fosheim Grøstad 
wrote:
> Or a method slice() that return the container as a slice? In 
> c++ containers have data and length, so I guess that is an 
> option too.

To elaborate, c++ containers have a member data() that points to 
the beginning of the contiguous buffer and a member size() that 
indicates the number of elements. D has a way to indicate length, 
but I don't think there is any commonly used data() equivalent? 
Although one probably could define a freestanding function that 
can be overloaded? Then you could just test with the compiles 
trait.



More information about the Digitalmars-d mailing list