代码改变世界

随笔档案-2013年1月20日

关于C++实现的Singleton收集 2

2013-01-20 23:22 by Scott Guthrie Liu, 183 阅读, 收藏,
摘要: boost的singletonhttp://www.cnblogs.com/fullsail/archive/2013/01/03/2842618.htmlhttp://leoxiang.com/dev/different-cpp-singleton-implementaionView Code // 实现基于以下假设:良好的设计在进入main函数之前应该是单线程的,// 因此可以使用全局变量的方式来设计singleton,// 并且保证在使用该singleton之前其已经被正确的初始化。 template <typename T>class Singleton{public: s 阅读全文