Singleton Class

CSingleton provides the instance pointer for a singleton class. To use CSingleton, simply derive your singleton class from CSingleton:

class CMySingletonObject : public CSingleton<CMySingletonObject>

CMySingletonObject g_Instance;

You can then retrieve the instance pointer using the GetInstance() method:


CSingleton provides performs various asserts that only one instance is ever created

Thats about it!

Subscribe for more like this. No spam, just fun tech stuff :)

Or, find me on Twitter: @toptensoftware.