On Wednesday, 10 October 2018 at 13:24:42 UTC, Codifies wrote:
I'm not sure I understand what mapNode[6]* means! (the second
version is what I wanted an array of 6 pointers)
oddly when assigning a null to one element of the array it
cause an error as it was trying to do an array copy... so
what's going on and what does that definition actually mean ?
mapNode[6]* can be read right-to-left as 'a pointer to an array
of 6 mapNodes'.
For simplicity, let's use int instead of mapNode:
unittest {
int[6]* p;
int[6] arr;
p = &arr;
(*p)[0] = 1;
(*p)[1] = 2;
(*p)[2] = 3;
(*p)[3] = 4;
(*p)[4] = 5;
(*p)[5] = 6;
assert(arr == [1,2,3,4,5,6]);
}
--
Simen