D-Programming-Language/phobos — pull request #747 by lomereiter (2012-08-11 08:54:29+00:00)
Title: fix behaviour of std.stdio.File.ByLine

Suppose user wants to skip first M lines in a file. The code expected to work is

auto lines = file.byLine();
popFrontN(lines, M);
foreach (line; lines) { ... }

However, because of lazy initialization of `line` together with condition `if (line is null) popFront()` in `front` this didn't work: during `popFrontN` calls `line` is set to non-null value, and additional `popFront` never happens, causing the range to be off by one line.
I've replaced the condition with boolean variable and added unit tests.