a) The compare function takes 2 parameters, each of which should be a reference to const matrix because the function doesn't modify the objects. Also, we can't pass const matrix objects to the compare function if it doesn't accept const objects
b) The change_val function is ok, but I think it's better if we make it accept a reference to vector\::iterator instead (better performance). Also add parameter names to make the function clearer
Exercise 6.18
a) The
compare
function takes 2 parameters, each of which should be a reference to const matrix because the function doesn't modify the objects. Also, we can't pass const matrix objects to thecompare
function if it doesn't accept const objectsb) The::iterator instead (better performance). Also add parameter names to make the function clearer
change_val
function is ok, but I think it's better if we make it accept a reference to vector\