Instead of relying on the compiler to do something clever in that context, overload a constructor to create the submatrix, the "minor" of ''matrix matrix::getminor(p1, ..., pn)', directly as the elements of a new matrix.
If you now have this:
Code:
matrix a;
matrix b;
// ...
b = a.getminor(x, y, cx, cy);
You'll get thins:
Code:
matrix a;
// ...
matrix b(a, x, y, cx, cy);
(If there are any, you may want to lift the duplicate parts of 'matrix::matrix(const matrix &)', 'matrix & matrix:perator = (const matrix &)', 'matrix matrix::getminor(p1, ..., pn)', and 'void matrix::getminor(matrix &, p1, ..., pn)' out and put them in a shared function.)
Soma