Skip to content

iNevd/singleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C++11 singleton class template

C++11 单例类模板 (thread safe for c++11)

Usage

class Test : public Singleton<Test> {
public:
	Test() {
		std::cout << "default constructor" << std::endl;
	}
}

Test* test = Test::getInstance();
class Test2 : public Singleton<Test2, int> {
public:
	Test(int) {
		std::cout << "constructor with args" << std::endl;
	}
}

Test2* test2 = Test2::getInstance(100);

About

c++11 singleton class template.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages