Skip to content

Instantly share code, notes, and snippets.

@vinipsmaker
Created October 5, 2013 13:04
Show Gist options
  • Save vinipsmaker/6840733 to your computer and use it in GitHub Desktop.
Save vinipsmaker/6840733 to your computer and use it in GitHub Desktop.
template<typename T>
class Singleton
{
public:
static T &instance()
{
if (!instance)
instance_ = new T;
return *instance_;
}
private:
static T *instance_;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment