is it possible to define a property to access (read/write) a matrix? (I.e., more dimensions than a vector)

Mike Parker aldacron71 at yahoo.com
Thu Jul 27 17:49:51 PDT 2006


Charles D Hixson wrote:
> If it is possible, then could someone point me to where it's
> documented?  Or show me an example of how?
> 
> Thank you.

Do you mean like this?

class MyMatrix
{
    float opIndex(uint i, uint j)
    {
       return values[i][j];
    }

    float opIndexAssign(float val, uint i, uint j)
    {
       values[i][j] = val;
    }
}

MyMatrix mat = new mat;
mat[0,0] = 0.0f;
float f = mat[0,0];



More information about the Digitalmars-d-learn mailing list