Comment #0 by bearophile_hugs — 2014-10-25T16:28:03Z
Currently this works as expected with dmd 2.067alpha:
void main() {
import std.stdio: writeln, File, stdin;
import std.range: retro;
import std.array: array;
"test.d".File.byLine.array.retro.writeln;
}
But this:
void main() {
import std.stdio: writeln, File, stdin;
import std.range: retro;
"test.d".File.byLine.retro.writeln;
}
test.d(4,25): Error: template std.range.retro cannot deduce function from argument types !()(ByLine!(char, char)), candidates are:
...\dmd2\src\phobos\std\range.d(1966,6): std.range.retro(Range)(Range r) if (isBidirectionalRange!(Unqual!Range))
Perhaps File.byLine and File.byLineCopy can support reverse iteration of the lines of a file.
Comment #1 by bugzilla — 2020-01-03T13:47:05Z
Just a note: byLine.array is not supposed to work anyway. See issue 6495.
But the main idea, namely to make byLine and byLineCopy bidirectional ranges, is still valid.
Comment #2 by robert.schadek — 2024-12-01T16:22:49Z