Gamedev Framework (gf)  0.3.0
A C++11 framework for 2D games
Public Member Functions | List of all members
gf::SingletonStorage< T > Class Template Reference

A storage for a singleton. More...

#include <gf/Singleton.h>

Public Member Functions

template<typename... Args>
 SingletonStorage (Singleton< T > &ref, Args &&...args)
 Construct a storage for a singleton. More...

Detailed Description

template<typename T>
class gf::SingletonStorage< T >

A storage for a singleton.

This class is a wrapper around an object of class T that should be unique in the system. It works in cooperation with a global variable of type gf::Singleton<T>. The global variable is for the access of the object while this class is for the storage of the object. The global variable is initialized at the storage construction.

int main() {
gf::SingletonStorage<Foo> fooStorage(gFoo);
See also

Constructor & Destructor Documentation

template<typename T>
template<typename... Args>
gf::SingletonStorage< T >::SingletonStorage ( Singleton< T > &  ref,
Args &&...  args 

Construct a storage for a singleton.

refa reference to a singleton (a global variable)
argsarguments for the constructor of class T