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 this is sort of a misdesign in C++ and unnecessarily complicated, or there is a practical or theoretical reason which I cannot see.
Non-const static members of the class can already be modified by any (const and non-const) methods of the class. There's no need and no point in declaring it with mutable
. That would achieve absolutely nothing.