first commit
This commit is contained in:
28
include/platform/memory/singleton.h
Normal file
28
include/platform/memory/singleton.h
Normal file
@ -0,0 +1,28 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __SINGLETON__
|
||||
#define __SINGLETON__
|
||||
|
||||
|
||||
namespace GS {
|
||||
|
||||
template <class T> class Singleton
|
||||
{
|
||||
static T *i;
|
||||
|
||||
public:
|
||||
|
||||
static T &Get() { return *i; }
|
||||
static void Set(T *s) { i = s; }
|
||||
static void Free() { delete i; i = nullptr; }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // __SINGLETON__
|
||||
Reference in New Issue
Block a user