I have this function:
void foo(const double *const *matrix, unsigned num_rows, unsigned num_columns){
//matrix[0][0] = 5; // ERROR: expression must be a modifiable lvalue
for (unsigned i = 0; i < num_rows; i++) delete matrix[i];
delete matrix;
}
...wherein the function cannot change the values at any given index in the matrix, yet it is still able to delete the matrix or any of its rows. Is there a way to pass in a 2D matrix and guarantee that it will not be altered in any way?
Edit: it doesn't look like there's a way to do this, so I'll probably switch to using vectors.