3 #ifndef INCLUDE_NN_NLIB_SINGLETON_H_
4 #define INCLUDE_NN_NLIB_SINGLETON_H_
18 T* ptr =
reinterpret_cast<T*
>(&m_Memory[0]);
21 static T& GetInstance() {
return Instance(); }
25 static int32_t m_Flag;
28 NLIB_ALIGNAS(8) static
unsigned char m_Memory[sizeof(T)];
36 void Singleton<T>::Init() {
44 int32_t Singleton<T>::m_Flag = 0;
48 #if !defined(NN_PLATFORM_CTR)
49 NLIB_ALIGNAS(8) unsigned
char Singleton<T>::m_Memory[sizeof(T)];
51 unsigned char Singleton<T>::m_Memory[
sizeof(T)];
57 #endif // INCLUDE_NN_NLIB_SINGLETON_H_
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
Singleton initialized by the object when first used.
A file that contains the configuration information for each development environment.
#define NLIB_ALIGNAS(x)
Defines alignas(x) or the equivalent.
static T & Instance()
Gets the singleton instance of T.