HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GusdUT_StaticValHolder< Fn > Struct Template Reference

#include <UT_StaticInit.h>

Public Types

typedef GusdUT_StaticValHolder
< Fn > 
This
 
using T = decltype(std::declval< Fn & >()())
 

Public Member Functions

 GusdUT_StaticValHolder (Fn &fn)
 
 GusdUT_StaticValHolder (This &&o) noexcept
 
 ~GusdUT_StaticValHolder ()
 
Toperator* ()
 
Toperator-> ()
 
Tget ()
 

Detailed Description

template<typename Fn>
struct GusdUT_StaticValHolder< Fn >

Helper for creating a static value, whose construction is deferred and backed by a lock. This is similar to UT_SingletonWithLock, except that the value held is the result of calling method, rather than constructing an object.

Example usage:

T* someFn();
static auto staticVal(GusdUT_StaticVal(someFn));
// Function is not exec'd until accessed.
// To access:
T* val = *staticVal;
// Or:
staticVal->method();

Definition at line 53 of file UT_StaticInit.h.

Member Typedef Documentation

template<typename Fn >
using GusdUT_StaticValHolder< Fn >::T = decltype(std::declval<Fn&>()())

Definition at line 57 of file UT_StaticInit.h.

template<typename Fn >
typedef GusdUT_StaticValHolder<Fn> GusdUT_StaticValHolder< Fn >::This

Definition at line 56 of file UT_StaticInit.h.

Constructor & Destructor Documentation

template<typename Fn >
GusdUT_StaticValHolder< Fn >::GusdUT_StaticValHolder ( Fn &  fn)
inline

Definition at line 59 of file UT_StaticInit.h.

template<typename Fn >
GusdUT_StaticValHolder< Fn >::GusdUT_StaticValHolder ( This &&  o)
inlinenoexcept

Definition at line 62 of file UT_StaticInit.h.

template<typename Fn >
GusdUT_StaticValHolder< Fn >::~GusdUT_StaticValHolder ( )
inline

Definition at line 69 of file UT_StaticInit.h.

Member Function Documentation

template<typename Fn >
T* GusdUT_StaticValHolder< Fn >::get ( )
inline

Definition at line 75 of file UT_StaticInit.h.

template<typename Fn >
T& GusdUT_StaticValHolder< Fn >::operator* ( )
inline

Definition at line 72 of file UT_StaticInit.h.

template<typename Fn >
T* GusdUT_StaticValHolder< Fn >::operator-> ( )
inline

Definition at line 73 of file UT_StaticInit.h.


The documentation for this struct was generated from the following file: