I know why non-const static member cannot be initialized inside class declaration. It is because class declaration doesn't allocate memory space. It's just a description.
But why const static member escape this concept? Won't it just to facilitate my coding?
1 2 3 4
class test{
conststaticint m = 10;//ok, but why?
staticint n = 11;//error
};
All static data members of a class have external linkage; whether const or not.
> But why const static member escape this concept? Won't it just to facilitate my coding?
The brace-or-equal-initializer allowed as part of the declaration of a non-volatile const static data member of integral type is to facilitate its use in constant expressions.