InputStream.opApply docs offer the following example:
Stream file = new BufferedFile("sample.txt");
foreach(ulong n, string line; file) {
stdout.writefln("line %d: %s",n,line);
}
file.close();
This is seductively simple and desirable but doesn't compile, since line is invariant and readLine() returns char[]. Either docs need to be fixed to use char[] or the method needs to return a string.
Comment #1 by witold.baryluk+d — 2010-11-24T07:52:30Z
For reference: this bug is related to bug2081
Comment #2 by rinick — 2011-03-09T02:27:29Z
*** Issue 5724 has been marked as a duplicate of this issue. ***
Comment #3 by andrej.mitrovich — 2014-04-23T18:27:48Z