[Issue 11830] New: std.stdio.byLine reports extra line if you don't call .front

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 27 10:19:05 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11830

           Summary: std.stdio.byLine reports extra line if you don't call
                    .front
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: peter.alexander.au at gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au at gmail.com> 2013-12-27 10:19:03 PST ---
If you don't call 'front' while iterating a ByLine range, you get a different
number of elements.

import std.stdio;
import std.range;
import std.algorithm;
void main()
{
    File("stuff", "w").write("line 1\nline 2\n");
    writeln(File("stuff").byLine.walkLength);
    writeln(File("stuff").byLine.filter!"true".walkLength);
}

This prints:

3
2

This should print 2 in both cases.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list