class Singleton {
public:
static Singleton* getInstance() {
static Singleton *p = new Singleton();
return p;
}
private:
Singleton() {}
~Singleton() {}
};
2 条回复 • 2018-09-27 23:29:26 +08:00
|
1
billlee 2018 年 9 月 27 日
没有加锁
|
|
2
innoink 2018 年 9 月 27 日 via Android
c++11 的话是没问题的
|