Anklang C++ API 0.0.0
Loading...
Searching...
No Matches
Persistent< Class >final

#include "cxxaux.hh"

Public Member Functions

operator bool () const ASE_PURE
Class &operator* () ASE_PURE
Class *operator-> () ASE_PURE
constexprPersistent () noexcept

Detailed Description

template<class Class>
class Ase::Persistent< Class >

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`.

Constructor & Destructor Documentation

Persistent()

template<class Class >
constexpr Persistent ( )
constexprnoexcept

A constexpr constructor avoids the static initialization order fiasco.

Member Function Documentation

operator bool()

template<class Class >
operator bool ( ) const
explicit

Check if `this` stores a `Class` instance yet.

operator*()

template<class Class >
Class & operator* ( )

Retrieve reference to `Class` instance, always returns the same reference.

operator->()

template<class Class >
Class * operator-> ( )

Retrieve pointer to `Class` instance, always returns the same pointer.