new int[]
Dukc
ajieskola at gmail.com
Thu Jan 11 17:07:43 UTC 2018
On Wednesday, 10 January 2018 at 23:08:28 UTC, Luís Marques wrote:
>> void main()
>> {
>> int[]* x = &[[1, 2, 3]][0];
>> int[]* x2 = [[1, 2, 3]].ptr; /* same */
>> }
> 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 :(
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.
More information about the Digitalmars-d-learn
mailing list