xentara-utils v1.2.1
Xentara utilities library
Loading...
Searching...
No Matches
xentara::utils::memory::SafeGlobal< Object > Class Template Referencefinal

A container that holds an object that is safe from the static initialization order fiasco. More...

#include <memory/SafeGlobal.hpp>

Public Member Functions

auto get () const noexcept -> const Object &
 Gets the object.
 
auto get () noexcept -> Object &
 Gets the object.
 
auto operator* () const noexcept -> const Object &
 Indirection operator.
 
auto operator* () noexcept -> Object &
 Indirection operator.
 
auto operator-> () const noexcept -> const Object *
 Member access operator.
 
auto operator-> () noexcept -> Object *
 Member access operator.
 

Detailed Description

template<typename Object>
class xentara::utils::memory::SafeGlobal< Object >

A container that holds an object that is safe from the static initialization order fiasco.

This class contains a value constructed object that can safely be used from constructors of other globals without having to worry about static initialization order

Member Function Documentation

◆ get() [1/2]

template<typename Object >
auto xentara::utils::memory::SafeGlobal< Object >::get ( ) const -> const Object &
noexcept

Gets the object.

◆ get() [2/2]

template<typename Object >
auto xentara::utils::memory::SafeGlobal< Object >::get ( ) -> Object &
noexcept

Gets the object.

◆ operator*() [1/2]

template<typename Object >
auto xentara::utils::memory::SafeGlobal< Object >::operator* ( ) const -> const Object &
noexcept

Indirection operator.

◆ operator*() [2/2]

template<typename Object >
auto xentara::utils::memory::SafeGlobal< Object >::operator* ( ) -> Object &
noexcept

Indirection operator.

◆ operator->() [1/2]

template<typename Object >
auto xentara::utils::memory::SafeGlobal< Object >::operator-> ( ) const -> const Object *
noexcept

Member access operator.

◆ operator->() [2/2]

template<typename Object >
auto xentara::utils::memory::SafeGlobal< Object >::operator-> ( ) -> Object *
noexcept

Member access operator.