template<typename T>
class CppCommon::Singleton< T >
Singleton template base class.
Singleton base class is used to protect child class from being created multiple times and provide a static GetInstance() method to access the single instance.
Thread-safe.
Example:
{
public:
void Test() { ... }
private:
MySingleton() = default;
~MySingleton() = default;
};
int main(int argc, char** argv)
{
MySingleton::GetInstance().Test();
return 0;
}
Singleton template base class.
https://en.wikipedia.org/wiki/Singleton_pattern
- Examples
- utility_singleton.cpp.
Definition at line 46 of file singleton.h.