[Issue 10718] New: std.algorithm.copy should keep the type of the characters it copies

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 26 05:11:56 PDT 2013


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

           Summary: std.algorithm.copy should keep the type of the
                    characters it copies
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-07-26 05:11:55 PDT ---
Phobos Range-based functions see strings and char[] to arrays of dchar, but I
think that behavour is not good for std.algorithm.copy too:


import std.algorithm: copy;
void main() {
    char[5] arr1 = "hello", arr2;
    arr1[].copy(arr2[]); // Error.
    dchar[arr1.length] arr3;
    arr1[].copy(arr3[]); // OK.
}



(Ali from D learns says that he would expect copy to maintain the same type.)

See also:

import std.array: array;
void main() {
    char[5] arr = "hello";
    pragma(msg, typeof(arr.array)); // Prints: dchar[]
}

-- 
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