Skip to content

Instantly share code, notes, and snippets.

@amigo421
Created January 24, 2020 12:46
Show Gist options
  • Select an option

  • Save amigo421/e165c9012439fb7a277cd094d7978ef7 to your computer and use it in GitHub Desktop.

Select an option

Save amigo421/e165c9012439fb7a277cd094d7978ef7 to your computer and use it in GitHub Desktop.
singleton template
template <typename T> class singleton {
void operator=(T const &) = delete;
singleton(T const &) = delete;
public:
static T &get_instance() {
static T inst;
return inst;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment