- You have to allocate an actual one:
ActualType* Singleton<ActualType>::m_instance=NULL;
- And you have to remember to delete it in OnDeinit.
- I use this pattern
#define DISALLOW_COPY_AND_ASSIGN(T) void T(const T&); void operator=(const T&) class Noncopyable{ protected: // Abstract void Noncopyable(void){} //[Ctor] private: DISALLOW_COPY_AND_ASSIGN(Noncopyable); }; class Singleton : Noncopyable { private: static T* m_instance; // Singleton(Singleton const&); // Singleton& operator = (Singleton const&); protected: :
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Since build 900 allows us to make parametrized classes I was trying to find a way of creating a Singleton base class. There is nearly no information about Template classes so
i tried to mimic c++ kind of template classes.
Of course, this doesn't work. But I am missing anything about it in the docs so.. did anyone else created a similar Singleton template class? Can you share it with me / the world?
Thank you