buffered input
Tomek Sowiński
just at ask.me
Sun Feb 6 16:30:48 PST 2011
Andrei Alexandrescu napisał:
> >> Truely circular, probably not, but a wrap-around slice (circular view
> >> of length at most underlying.length) does offer that and solves the
> >> copy problem with style.
> >
> > Right.
>
> With fixed lookahead you can't do a lot of things - such as line
> continuation in C programs or CSV files. There are plenty of other
> examples. Generally I believe k-lookahead is a thing of the past and
> infinite-lookahead is where the future is.
Amen. But I don't see how wrap-around slices stand in the way. When you need more capacity, resize the internal buffer array and let front() expose a new wrap-around slice. Just like you'd do with T[]. The only difference is you don't care if a fetch goes over the edge.
--
Tomek
More information about the Digitalmars-d
mailing list