Skip to content

Instantly share code, notes, and snippets.

@simonlynen
Created November 16, 2015 19:00
Show Gist options
  • Save simonlynen/180f291bcd5087b5bc17 to your computer and use it in GitHub Desktop.
Save simonlynen/180f291bcd5087b5bc17 to your computer and use it in GitHub Desktop.
Singleton with local static
class Singleton {
public:
static Singleton& Instance() {
static Singleton instance;
return instance;
}
private:
Singleton() = default;
~Singleton() = default;
Singleton(const Singleton&) = delete;
Singleton& operator=(const Singleton&) = delete;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment