Как стать автором
Обновить

Комментарии 3

Давайте чуть повнимательнее почитаем
If a static data member is of const integral or const enumeration type, its declaration in the class definition can
specify a constant-initializer which shall be an integral constant expression (5.19). In that case, the member can appear
in integral constant expressions. The member shall still be defined in a namespace scope if it is used in the program and
the namespace scope definition shall not contain an initializer.

Выделим ключевую фразу:
The member shall still be defined in a namespace scope if it is used in the program and
the namespace scope definition shall not contain an initializer.

То есть если она будет использоваться извне, то необходимо выносить объявление из тела. Студия работает не по стандарту, впрочем ничего сильно страшного я в этой ситуации не вижу.
Вроде понятно, спасибо за разъяснения.
Но тогда перестает работать объявление массива, когда его размер задан статической константной переменной из заголовка класса ;-(
Зарегистрируйтесь на Хабре, чтобы оставить комментарий

Публикации

Истории