On Tuesday, 20 August 2013 at 17:02:07 UTC, Jonathan M Davis wrote:
On Tuesday, August 20, 2013 12:54:29 John Colvin wrote:
is there an allocation in this?

enum vals=[1, 2, 3, 0];

int[4] a;
a[] = vals[];

Since, you're asking it to copy the elements of a dynamic array to a static one, I would fully expect it to result in an allocation, though a smart compiler might optimize it out. I wouldn't expect dmd to do that though.

- Jonathan M Davis

So you're saying it will allocate a new dynamic array, initialise it with 1,2,3,0 and then copy the elements from that new array to the static one? That's not good...

Reply via email to