[Issue 4346] New: More flexible std.array.array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 19 06:32:31 PDT 2010


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

           Summary: More flexible std.array.array
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-06-19 06:32:28 PDT ---
Dmd v2.047 rejects all the following programs:


import std.array: array;
void main() {
    int[2] a = [1, 2];
    assert(array(a) == [1, 2]);
}


import std.container: SList;
import std.array: array;
void main() {
    auto l = SList!int(1, 2);
    assert(array(l) == [1, 2]);
}


import std.container: SList;
import std.array: array;
void main() {
    auto l = SList!int(1, 2);
    assert(array(l[]) == [1, 2]);
}


If a collection can be iterated with foreach, and its items can be copied, then
array() has to work on it (and use the Appender for performance where the
length of the collection is not known).

See also bug 4114

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