Trying to understand multidimensional arrays in D

Rekel paultjeadriaanse at gmail.com
Tue Dec 22 05:11:07 UTC 2020


Small addition, not out of jest;
If plug and play consistency given aliases is required (which 
seems pointless, as they exit to be used), the best solution, 
which would avoid indexing inconsistency given regular reading 
order, would be the following;

alias Row = [3]int;
[1][2][3]int history;
int last_element = history[0][1][2];
[1][2]Row history;
int last_element = history[0][1][2];
Row last_row = history[0][1];

This would be consistent, and readable.


More information about the Digitalmars-d-learn mailing list