"Cannot infer argument types" for foreach over byLine
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 24 00:14:55 PST 2015
import std.stdio;
void main()
{
foreach (i, line; file.byLine())
{
writeln(line);
}
}
This code gives me the error:
Error: cannot infer argument types, expected 1 argument, not 2
This is a very obtuse compiler message considering how simple the
code is; I know it's got something to do with the foreach
statement and what byLine() returns, but I can't seem to get it
to compile without removing `i`.
More information about the Digitalmars-d-learn
mailing list