Thread overview
typo mapNode[6]* exits; instead of mapNode*[6] exits; but whats it mean ?
Oct 10, 2018
Codifies
Oct 10, 2018
Simen Kjærås
Oct 10, 2018
Codifies
October 10, 2018
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 ?
October 10, 2018
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
October 10, 2018
On Wednesday, 10 October 2018 at 13:36:20 UTC, Simen Kjærås wrote:
> mapNode[6]* can be read right-to-left as 'a pointer to an array

right... hence the failed attempt at an array copy... now I understand...