deprecating std.stream, std.cstream, std.socketstream
Steven Schveighoffer
schveiguy at yahoo.com
Wed May 16 08:32:26 PDT 2012
On Wed, 16 May 2012 11:19:46 -0400, Robert Clipsham
<robert at octarineparrot.com> wrote:
> On 16/05/2012 15:38, Steven Schveighoffer wrote:
>> On Wed, 16 May 2012 09:50:12 -0400, Walter Bright
>> <newshound2 at digitalmars.com> wrote:
>>
>>> On 5/15/2012 3:34 PM, Nathan M. Swan wrote:
>>>> I do agree for e.g. with binary data some data can't be read with
>>>> ranges (when
>>>> you need to read small chunks of varying size),
>>>
>>> I don't see why that should be true.
>>
>> How do you tell front and popFront how many bytes to read?
>>
>> -Steve
>
> A bit ugly but:
> ----
> // Default to 4 byte chunks
> auto range = myStream.byChunks(4);
> foreach (chunk; range) {
> // Set the next chunk is 3 bytes
> // Chunk after is 4 bytes
> range.nextChunkSize = 3;
>
> // Next chunk is always 5 bytes
> range.chunkSize = 5;
> }
Yeah, I've seen this before. It's not convincing.
-Steve
More information about the Digitalmars-d
mailing list