[RFC] I/O and Buffer Range

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Jan 17 01:33:39 PST 2014


17-Jan-2014 13:19, Kagamin пишет:
> On Thursday, 16 January 2014 at 15:55:07 UTC, Steven Schveighoffer wrote:
>> I am thinking of this layout for streams/buffers:
>>
>> 1. Unbuffered stream used for raw i/o, based on a class hierarchy
>> (which I have pretty much written)
>> 2. Buffer like you have, based on a struct, with specific primitives.
>> It's job is to collect data from the underlying stream, and present it
>> to consumers as a random-access buffer.
>
> If you have a struct-based buffer, how would you enlarge the buffer?

What's the problem? I don't see how struct/class can change there 
anything, it's a member field that is an array that we surely can expand.

> Won't it suffer from AA syndrome?

Buffer is created with factory functions only. It's not like an AA that 
grows from an empty/null state. Empty buffer (.init) doesn't grow it's 
simply empty.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list