skip to main
|
skip to sidebar
C/C++ Notes
A Singleton Class Example
template
class SharedSingleton
{
public:
static T& getInstance()
{
if(thePTRInstance.get() == NULL)
thePTRInstance.reset(new T);
return *thePTRInstance;
}
protected:
SharedSingleton(){};
private:
static std::auto_ptr< T > thePTRInstance;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment