std.range.cacheFront proposal&working code: wraps a range to enforce front is called only once

Timothee Cour thelastmammoth at gmail.com
Thu Oct 24 23:19:31 PDT 2013


On Wed, Oct 23, 2013 at 5:47 PM, deadalnix <deadalnix at gmail.com> wrote:

> Overall, I think it is greatly needed :D
>
> You should propose that as a pull request. Also, you shouldn't alias this
> the source range, as thing now become impracticable.
>

could you elaborate on that?


>
> IMO, CacheFront should be a froward range whatever the source is and only
> provide front/popFront.
>

some range properties still make sense to forward:
* length if it's there
* if the range is random access, I could use memoize (on array index)
* other cases possible
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131024/1da13d96/attachment.html>


More information about the Digitalmars-d mailing list