www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4346] New: More flexible std.array.array

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Jun 19 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4346


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsimcha yahoo.com
         Resolution|                            |FIXED


--- Comment #1 from David Simcha <dsimcha yahoo.com> 2010-08-18 17:55:40 PDT ---
Fixed in changeset 1898.  http://dsource.org/projects/phobos/changeset/1898

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