[Issue 10543] New: std.algorithm.map incorrectly uses source range length for narrow strings

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 4 09:30:33 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10543

           Summary: std.algorithm.map incorrectly uses source range length
                    for narrow strings
           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-07-04 09:30:32 PDT ---
void main()
{
    import std.algorithm;
    import std.stdio;
    string s = "こんにちは世界";
    auto m = s.map!(a => 1);
    writeln(m, ", ", m.length);
}

Gives:

[1, 1, 1, 1, 1, 1, 1], 21

Clearly the reported length (21) is wrong, it should be 7.

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


More information about the Digitalmars-d-bugs mailing list