Declares a global variable that is initialized at runtime and whose destructor is never run.
This class is the same as pw::NoDestructor, except that pw::NoDestructor may be constinit if T is constexpr constructible. pw::RuntimeInitGlobal instances can never be constinit. pw::RuntimeInitGlobal prevents constant initialization inserting empty volatile inline assembly.
RuntimeInitGlobal should only be used when T should not be constant initialized; otherwise, use pw::NoDestructor. Constant initialization moves objects from .bss to .data. This can increase binary size if the object is larger than the code that initializes it.RuntimeInitGlobal can cause memory leaks and other problems. RuntimeInitGlobal should only be used for global variables. Public Types | |
| using | value_type = T |
Public Member Functions | |
| template<typename... Args, typename std::enable_if<!std::is_same< void(std::decay_t< Args > &...), void(RuntimeInitGlobal &)>::value , int , ::type = 0> | |
| RuntimeInitGlobal (Args &&... args) | |
| RuntimeInitGlobal (const T &x) | |
| RuntimeInitGlobal (T &&x) | |
| RuntimeInitGlobal (const RuntimeInitGlobal &)=delete | |
| RuntimeInitGlobal & | operator= (const RuntimeInitGlobal &)=delete |
| const T & | operator* () const |
| T & | operator* () |
| const T * | operator-> () const |
| T * | operator-> () |