I'm using the following singleton model for all of my resource managers.
Code:
#pragma once
class CSingleton
{
private:
static CSingleton *m_pInstance;
protected:
CSingleton();
CSingleton(const CSingleton&);
CSingleton& operator(const CSingleton&);
public:
static CSingleton *Instance();
};
Code:
#include "CSingleton.h"
CSingleton *CSingleton::m_pInstance=NULL;
CSingleton *CSingleton::Instance()
{
if (m_pInstance==NULL) m_pInstance=new CSingleton;
return m_pInstance;
}
My resource managers are then derived from CSingleton.
How would I go about creating a templated version of this singleton class to allow for differing types w/o having to derive from CSingleton?