On Friday, 24 October 2014 at 23:46:28 UTC, uri wrote:
On a related note, does the D spec guarantee the following will be rectangular in memory?auto a = [ [1,2],[3,4] ]; Cheers, uri
I just checked the docs and auto a = [ [1,2],[3,4] ] will be an an array of pointers. So this cannot work (unless the compiler truly is magical :)
auto a = [ [1,2],[3,4] ]; cast(int[2][2])(a); but this should work: enum a = [ [1,2],[3,4] ]; cast(int[2][2])(a); (all untested) Thanks, uri