Initialisation of static class member. Why constexpr?
问题 when I want to have a static pointer as a member of a class I need constexpr for the initialisation with nullptr . class Application { private: constexpr static Application* app = nullptr; } Can someone explain me why I need to do that? I cannot find the exact reason why it`s necessary that the static variable has to exist at compile time. 回答1: That's because you're initialising it inside the class definition. That's only allowed for constant integral and enumeration types (always) and for