Need for (C++20) Contiguous Range

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri Oct 9 13:17:59 UTC 2020


On Friday, 9 October 2020 at 13:05:44 UTC, Petar Kirov 
[ZombineDev] wrote:
> I think Steven's idea is not that the container itself is a 
> contiguous range, but that slicing it would return a contiguous 
> range, which itself is a D slice. I.e. you need to implement 
> opSlice() (or opIndex()) with no parameters, which should 
> return a slice of the container's contents.

Alright, I guess I would want to access the underlying buffer 
regardless of whether the container is indexable or not...

Although, an optimization protocol probably should let you query 
whether elements can be out of order. And possibly also test 
whether an element is present or not.

Then you could allow direct access to the buffer of a simple hash 
table or priority queue etc.

Hm. Interesting topic.



More information about the Digitalmars-d mailing list