CppCommon  1.0.4.1
C++ Common Library
utility_singleton.cpp

Singleton example

#include <iostream>
class MySingleton : public CppCommon::Singleton<MySingleton>
{
public:
void Test() { std::cout << "MySingleton::Test()" << std::endl; }
private:
MySingleton() { std::cout << "MySingleton::MySingleton()" << std::endl; }
~MySingleton() { std::cout << "MySingleton::~MySingleton()" << std::endl; }
};
int main(int argc, char** argv)
{
MySingleton::GetInstance().Test();
return 0;
}
Singleton template base class.
Definition: singleton.h:47
Singleton definition.