Stream Proposal
Kagamin
spam at here.lot
Mon Mar 14 08:32:33 PDT 2011
Andrei Alexandrescu Wrote:
> A simple input buffered stream of T would be a range of T[] that has two
> extra primitives:
>
> T[] lookAhead(size_t n);
> void leaveBehind(size_t n);
T front();
T[] front(size_t n); // bulk front
void popFront(size_t n=1); // bulk popFront
> I'm not sure there's a need for formalizing a buffered output interface
> (we could simply make buffering transparent, in which case there's only
> need for primitives that get and set the size of the buffer).
>
> In case we do want to formalize an output buffer, it would need
> primitives such as:
>
> T[] getBuffer(size_t n);
> void commitBuffer(size_t n);
void put(T); // as usual
void put(T[]); // bulk put; can pass a slice of the buffer from getBuffer
?
More information about the Digitalmars-d
mailing list