On Wednesday, 10 January 2018 at 23:08:28 UTC, Luís Marques wrote:
That's an interesting solution. I'm not sure which one I prefer, the wrapper or this one. Still... I feel like the language should just allow allocating an array itself on the GC heap :(void main() { int[]* x = &[[1, 2, 3]][0]; int[]* x2 = [[1, 2, 3]].ptr; /* same */ }
I believe this does allocate from the automanaged heap already. At least it won't work with @nogc. If one wants to reserve the memory from the program space, he needs to use module-level static arrays. With immutable stuff I don't know, perhaps it's implementation dependant.
