mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-02-04 02:54:42 +08:00
support bazel complie this project and format code.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Created by light on 20-2-7.
|
||||
// 在C++11标准下,《Effective C++》提出了一种更优雅的单例模式实现,使用函数内的 local static 对象。
|
||||
// 这种方法也被称为Meyers' Singleton。
|
||||
// 在C++11标准下,《Effective C++》提出了一种更优雅的单例模式实现,使用函数内的
|
||||
// local static 对象。 这种方法也被称为Meyers' Singleton。
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
@@ -10,14 +10,13 @@ using namespace std;
|
||||
|
||||
class singleton {
|
||||
private:
|
||||
singleton() {}
|
||||
singleton() {}
|
||||
|
||||
public:
|
||||
static singleton &instance();
|
||||
static singleton &instance();
|
||||
};
|
||||
|
||||
singleton &singleton::instance() {
|
||||
static singleton p;
|
||||
return p;
|
||||
static singleton p;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user