c++11中线程安全单例模式( Meyers Singleton)

来源:互联网 发布:火车头数据采集器 编辑:程序博客网 时间:2024/06/05 19:41
class Singleton {public:static Singleton& Instance() {  static Singleton theSingleton;  return theSingleton;}/* more (non-static) functions here */private:Singleton(); // ctor hiddenSingleton(Singleton const&); // copy ctor hiddenSingleton& operator=(Singleton const&); // assign op. hidden~Singleton(); // dtor hidden};
原创粉丝点击