On 4/22/18 2:00 AM, WhatMeForget wrote:
Surely a stupid mistake on my part, but why is the first array repeated?
In addition to what Neia said, you shouldn't use pointers to dynamic
arrays. Such things are really hard to allocate on the heap, since new
int[] just makes an array, not a pointer
On Sunday, 22 April 2018 at 06:00:15 UTC, WhatMeForget wrote:
foreach(i, elem; a)
{
int[] temp = new int[](5);
..
a[i] = &temp;
}
You're taking the address of a local variable and persisting it
beyond the variable's scope. This is not safe in general;
compilers