/
githubmirror
/
CPlusPlusThings
Обзор
Документация
Войти
/
githubmirror
/
CPlusPlusThings
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
design_pattern/singleton/static_local_singleton.cpp
22 строки
421 B
zhangxing
support bazel complie this project and format code.
30 мар 2024, 17:00
30 мар 2024, 17:00
3c8a3f2
Код
Авторство
О чём код?
// // Created by light on 20-2-7. // 在C++11标准下,《Effective C++》提出了一种更优雅的单例模式实现,使用函数内的 // local static 对象。 这种方法也被称为Meyers' Singleton。 // #include <iostream> using namespace std; class singleton { private: singleton() {} public: static singleton &instance(); }; singleton &singleton::instance() { static singleton p; return p; }