@stahta01 -
You know, I think your approach is wrong, doing that thing:
Code:
const int& operator()(int row, int col) const
{ return m_vals[row * m_cols + col]; }
In case of:
Code:
// Constructor
Matrix m1(5, 5);
Matrix m2(5, 5);
// The non const operator()
m1(0, 0) = 1;
m2(0, 0) = 2;
// So far so good
// Now, let's do the following one:
m1(0, 0) = m2(0, 0); // I think here the compiler calls the const version of () invoked by m2. But now you have an element m1(0, 0) which is const reference - I think it's some of buggy