stream == range ? [Sliding window]

Dragos Carp via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 1 05:46:52 PDT 2015


On Monday, 1 June 2015 at 12:06:39 UTC, w0rp wrote:
> ...
> If you are writing code where you just want to grab large 
> chunks of data from a socket at a time, and you don't care 
> about the rest of the code operating on characters, you can do 
> this.
>
> someSocket.byChunk(bufferSize).joiner.doSomething;
>
> But then many ranges will already use an internal buffer, but 
> present a range of bytes anyway.

In a lot of cases 'doSomething` conveniently needs random access 
to the input data. With byChunk I cannot see how you can do this 
without copying.


More information about the Digitalmars-d mailing list