https://issues.dlang.org/show_bug.cgi?id=13556
--- Comment #9 from Ketmar Dark <[email protected]> --- (In reply to dennis.m.ritchie from comment #7) > I suggest to implement such a syntax for declaring multidimensional arrays: > > auto array = new int[11](4, 8, 6, 13 /* .... The length of the other > subarrays on request */); you can do almost the same with templates. auto DNew(T, A...) () if (A.length > 0) { template A2S(A...) { import std.conv : to; static if (A.length == 0) enum A2S = ""; else enum A2S = to!string(A[0])~","~A2S!(A[1..$]); } import std.array : replicate; return mixin("new "~T.stringof~"[]".replicate(A.length)~"("~A2S!A~")"); } void main () { import std.stdio; auto a = DNew!(int, 5, 6, 7); a[2][3][4] = 42; writeln(a[2][3][]); } --
