开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜