I'm wondering if my compiler will be smart enough to realize that the determinant() of this matrix has already been calculated and will reuse the value that was calculated earlier, or if I need to explicitly handle this to optimize the code to avoid calling determinant() twice? (ie, determinant() is being redundantly called inside of inverse(). m is not being changed between the two calls.)
I agree the answer is no, the compiler is not smart enough in general, but for small programs where everything is visible to the compiler all at once, it will sometimes collapse logic down if you have aggressive optimizations on (like -O3).
There's the Compiler Explorer you can use to test out theories about how the compiler will optimize piece of code: https://godbolt.org/
But I also disagree with TheIdeasMan; I seldom see it as a good idea to use mutable. Mostly because it forces you to toss out any semblance of thread safety and the compiler now cannot assume the state of the object is truly constant. I'm not saying to never use it, but I've seen it used as a way to preserve a backwards compatible interface with other components that expect a const object, while implementing caching (but those other components still have to know that things like thread safety are now out the window).