智能指针单例模式的实现

来源:互联网 发布:公司财务战略矩阵 编辑:程序博客网 时间:2024/05/01 10:58

static MyClass* MyClass::Instance()

{

static std::autoPtr<MyClass>  pSingleInstance;

 if ( pSingleInstance.get() == NULL )
    pSingleInstance.reset(new MyClass());

 return pSingleInstance.get();

}

原创粉丝点击