Hello,
why or for what reason is it not possible to declare a class member variable in C++ as "static mutable"? Something like
static mutable int t; //This won't compile
For me, there is no reason to ban such declarations. E.g. for reasons like maintaining a global class-wide statistics, it may be convenient to have static variable that can be altered by (logically) const methods. So either I this is sort of a misdesign in C++ and unnecessarily complicated, or there is a practical or theoretical reason which I cannot see as of now.
I could imagine it makes it easier to compile and optimize a C++-code which does not feature something like this, but I am not a compiler expert. Does anybody has advice on this topic?
Thanks!