stream == range ? [Sliding window]
w0rp via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 1 05:06:38 PDT 2015
I wonder if we even need something like popFrontN. Whenever I
have wanted to read chunks at a time, like some data from a TCP
socket, I have always specified a buffer size and tried to get as
much data as I can fit into my buffer for each iteration. You can
accomplish this with a range of chunks of data, like byChunk for
a file, and then operate on the chunks instead of individual
bytes.
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.
More information about the Digitalmars-d
mailing list