Skip to content

Commit

Permalink
feat:设计模式Meyers' Singleton去掉冗余代码,避免误导混淆
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Super committed Feb 23, 2022
1 parent b3dd817 commit 646f9e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion design_pattern/singleton/static_local_singleton.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//
// Created by light on 20-2-7.
// 在C++11标准下,《Effective C++》提出了一种更优雅的单例模式实现,使用函数内的 local static 对象。
// 这种方法也被称为Meyers' Singleton。
//

#include <iostream>
Expand All @@ -8,7 +10,6 @@ using namespace std;

class singleton {
private:
static singleton *p;
singleton() {}
public:
static singleton &instance();
Expand Down

0 comments on commit 646f9e1

Please sign in to comment.