智能指针单例模式的实现

    技术2022-05-11  54

    static MyClass* MyClass::Instance()

    {

    static std::autoPtr<MyClass>  pSingleInstance;

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

     return pSingleInstance.get();

    }


    最新回复(0)