template <class Class>
Ase::Persistent class final

Create an instance of Class on demand that is constructed and never destructed. Due to its constexpr ctor and on-demand creation of Class, a Persistent<> can be accessed at any time during the static ctor (or dtor) phases and will always yield a properly initialized Class.

Constructors, destructors, conversion operators

Persistent() constexpr noexcept
A constexpr constructor avoids the static initialization order fiasco.
operator bool() explicit
Check if this stores a Class instance yet.

Public functions

auto operator*() →  Class&
Retrieve reference to Class instance, always returns the same reference.
auto operator->() →  Class*
Retrieve pointer to Class instance, always returns the same pointer.