when want have static pointer member of class need constexprfor initialisation nullptr.
class application { private: constexpr static application* app = nullptr; } can explain me why need that? cannot find exact reason why it`s necessary static variable has exist @ compile time.
that's because you're initialising inside class definition. that's allowed constant integral , enumeration types (always) , constexpr data members (since c++11). normally, you'd initialise define (outside class), this:
application.h
class application { private: static application* app; } application.cpp
application* application::app = nullptr; note need provide out-of-class definition in constexpr case, must not contain initialiser then. still, believe second case want.
Comments
Post a Comment