[Issue 14026] More flexible array of array allocation syntax

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jan 22 09:51:27 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14026

--- Comment #2 from bearophile_hugs at eml.cc ---
(In reply to Temtaime from comment #1)
> Why not int[][3] = new int[n][3]; ?
> I think it's better.

That syntax is already taken. n needs to be a compile-time constant, and it
creates something different:

void main() @safe {
    enum int n = 2;
    auto m = new int[n][3];
    pragma(msg, typeof(m));
}

Output:

int[2][]

--


More information about the Digitalmars-d-bugs mailing list