Ranges, constantly frustrating
Regan Heath
regan at netmail.co.nz
Tue Feb 11 02:27:51 PST 2014
On Tue, 11 Feb 2014 10:10:27 -0000, Regan Heath <regan at netmail.co.nz>
wrote:
> Things like this should "just work"..
>
> File input ...
>
> auto range = input.byLine();
> while(!range.empty)
> {
> range.popFront();
> foreach (i, line; range.take(4)) //Error: cannot infer argument types
> {
> ..etc..
> }
> range.popFront();
> }
>
> Tried adding 'int' and 'char[]' or 'auto' .. no dice.
>
> Can someone explain why this fails, and if this is a permanent or
> temporary limitation of D/MD.
Further, the naive solution of adding .array gets you in all sorts of
trouble :p (The whole byLine buffer re-use issue).
This should be simple and easy, dare I say it trivial.. or am I just being
dense here.
R
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Digitalmars-d-learn
mailing list