Matrix(row, col) = value
double Matrix::operator()(unsigned in开发者_运维技巧t a, unsigned int b)
{
return m[a*rows+b];
}
I have the above currently for accessing the value stored in the matrix, however I'd like to be able to set the value at that position. Is that possible?
How about returning a reference:
double& Matrix::operator()(unsigned int a, unsigned int b)
{
return m[a*rows+b];
}
Then you can set the value of the corresponding element.
精彩评论