static array litteral syntax using a library solution (no GC and 40x faster!)

Benjamin Thaut code at benjamin-thaut.de
Sun Feb 3 05:26:45 PST 2013


Am 03.02.2013 10:23, schrieb timotheecour:

That is a nice idea, but I would really like a in language solution so that:

int[10] a = [1,2,3,4,5,6,7,8,9]; //does not allocate, just initializes a

void foo1(scope int[]) { ... }

foo1([1,2,3,4,5,6,7,8,9]); //allocates the literal on the stack

void foo2(int[]){ ... }

foo2([1,2,3,4,5,6,7,8,9]); //allocates the literal on the heap

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list