Design Patterns in C++
Singleton Pattern
Thread-safe singleton with Meyer's approach
Interview: System design — very common
Singleton
The Singleton pattern ensures only one instance of a class exists. In C++, Meyer's Singleton (using a function-local static) is the cleanest, thread-safe approach guaranteed by C++11.