fix compile

This commit is contained in:
Nikolay Korolev 2021-08-30 10:58:57 +03:00
parent 8cbdf27228
commit b67a087448
2 changed files with 22 additions and 19 deletions

View file

@ -4,6 +4,7 @@
// TODO - implement // TODO - implement
template<>
cCustomSoundTrack* base::cSingleton<cCustomSoundTrack>::mspInstance = nil; cCustomSoundTrack* base::cSingleton<cCustomSoundTrack>::mspInstance = nil;
cCustomSoundTrack::cCustomSoundTrack() : cCustomSoundTrack::cCustomSoundTrack() :

View file

@ -5,6 +5,26 @@
namespace base namespace base
{ {
class cSingletonBase;
class cSingletonManager
{
cSingletonBase* head;
cSingletonBase* tail;
public:
cSingletonManager() :
head(nil),
tail(nil)
{}
void Add(cSingletonBase*);
void Purge();
~cSingletonManager();
};
cSingletonManager& SingletonManager();
class cSingletonBase class cSingletonBase
{ {
friend class cSingletonManager; friend class cSingletonManager;
@ -19,7 +39,7 @@ template<typename T>
class cSingleton : public cSingletonBase class cSingleton : public cSingletonBase
{ {
static T* mspInstance; static T* mspInstance;
static void cSingleton<T>::CreateInstance() static void CreateInstance()
{ {
mspInstance = new T(); mspInstance = new T();
SingletonManager().Add(mspInstance); SingletonManager().Add(mspInstance);
@ -39,22 +59,4 @@ public:
} }
}; };
class cSingletonManager
{
cSingletonBase* head;
cSingletonBase* tail;
public:
cSingletonManager() :
head(nil),
tail(nil)
{}
void Add(cSingletonBase*);
void Purge();
~cSingletonManager();
};
cSingletonManager& SingletonManager();
} }