Do array literals still always allocate?
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun May 14 03:18:40 PDT 2017
On 05/14/2017 01:57 AM, Nicholas Wilson wrote:
> 1D arrays it doesn't, 2D or higher it does.
What do you mean? This works just fine as well:
----
import std.random;
import std.stdio;
int[2][2] testfunc(int num) @nogc
{
return [[0, 1], [num, 3]];
}
int main()
{
int[2][2] arr = testfunc(uniform(0, 15));
writeln(arr);
return 0;
}
----
More information about the Digitalmars-d-learn
mailing list