Multi-dimensional array syntax, opIndex

Spacen Jasset spacen at yahoo.co.uk
Mon Mar 10 15:49:00 PDT 2008


"Multidimensional" array syntax goes like this:

int a[4][4];

a[0][0] = 5;

Which is inline with C, C++. Does anyone know if the syntax [0, 0] was 
considered for e thlanguage and why was it decided against?


My second question is if I have a class, Matrix that internally has a 
float[4][4] inside. I cannot use opIndex to provide an array operator 
for row and column select. Instead I should use a function such as:

float getIndex(uint row, uint column) ...

Is this correct?


More information about the Digitalmars-d-learn mailing list