range.save

Freddy via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 23 17:38:58 PST 2015


On Tuesday, 24 November 2015 at 01:03:36 UTC, Steven 
Schveighoffer wrote:
> surely you mean opIndex? Note that ranges are required to 
> implement front, popFront, and empty. That's it, then it is a 
> range. Even save isn't required unless you want it to be a 
> forward range.

I meant .indexableRange, random access may require extra buffers 
or stack space that take space even when random access isn't 
used, and I'm asking for optional members(.retroRange, 
.indexableRange)

> But yes, a fundamental requirement is to be able to get the 
> front element repeatedly. This necessitates a buffer or "saving 
> of state".

Not quite what I was thinking. I was saying that ranges that 
implement back,popBack may need to implement a backwards buffer 
along a forward buffer even if the backwards buffer is never used.


More information about the Digitalmars-d mailing list