[Issue 13590] [Enh] Add std.algorithm.iterate

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Oct 8 17:22:57 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13590

Brad Anderson <eco at gnuk.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eco at gnuk.net

--- Comment #1 from Brad Anderson <eco at gnuk.net> ---
> It exposes a more general problem - given a Range of a Range of Elements, how does one iterate over Elements?

Well, rng.joiner.chunks(4) comes to mind normally but that, of course, breaks
down is with things like byChunk and byLine where the buffer is overwritten as
you process the range.

Dmitry had an idea for how to solve it so you could do things much more
naturally while still being extremely efficient.

The thread about it:

http://forum.dlang.org/post/l9q66g$2he3$1@digitalmars.com

His idea kind of evolves as the thread goes on so read more than the first
post. As far as I know he's still planning on hammering out the details and
making another proposal.

If memory serves me, with his proposal end users would be able to just do
rng.chunks(4) to accomplish this (with chunks implementation taking advantage
of the new buffer range primitives).

--


More information about the Digitalmars-d-bugs mailing list