range.save
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Mon Nov 23 17:03:36 PST 2015
On 11/23/15 7:10 PM, Freddy wrote:
> On Thursday, 19 November 2015 at 21:30:23 UTC, Freddy wrote:
>> ...
> Another problem I noticed with ranges is that all functionality is
> unionized. Ranges are expected to be able to popFront,Index,popBack,
> randomly possibly forcing ranges to carry unneeded buffers if indexing
> or popBack in never used.
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.
But yes, a fundamental requirement is to be able to get the front
element repeatedly. This necessitates a buffer or "saving of state".
-Steve
More information about the Digitalmars-d
mailing list