On 29/11/10 3:19 PM, so wrote:
Second why do mark something const if it is not, this is a wrong
approach even in C++ which provides explicit "mutable".

It is logical const. It is the correct approach in C++.

How are you going to do caching anyways, if static array is not the case?

struct matrix {
f32[4][4] m;
f32 det_cache; // ?
f32 mag_cache; // ?
f32 whatever_cache; // ?
};


I described the mechanisms of this in the original post. You have a 'is_dirty' member function, which is marked as true if you modify the matrix. The getDeterminant function only calculates the determinant if is_dirty is true, otherwise it returns the cached version.

Reply via email to