nlib
nn::nlib::SimpleSingleton< T > Class Template Referencefinal

Singleton of the type for implicitly constructing an instance based on a static variable before calling the main function. More...

#include "nn/nlib/SimpleSingleton.h"

Static Public Member Functions

static T & Instance ()
 Gets the singleton instance of T. More...
 

Detailed Description

template<class T>
class nn::nlib::SimpleSingleton< T >

Singleton of the type for implicitly constructing an instance based on a static variable before calling the main function.

Template Parameters
TThe singleton target class.
Description
Enables you to successfully get the instance by calling the Instance function from the static object code before the main function starts.
The default constructor must be defined in the T class. In addition, you must be operating on a single thread both before and after the main function runs.
Note that the order that the destructors are called when the program ends is undefined, so the processing of the type T destructor may result in dependency problems.
// Gets a singleton object.

Definition at line 11 of file SimpleSingleton.h.

Member Function Documentation

§ Instance()

template<class T>
nn::nlib::SimpleSingleton< T >::Instance ( )
inlinestatic

Gets the singleton instance of T.

Returns
The reference to the instance of T.

Definition at line 21 of file SimpleSingleton.h.


The documentation for this class was generated from the following files: