// // Created by dongl on 22-9-28. // #ifndef MSTL_SHARED_PTR_H #define MSTL_SHARED_PTR_H #endif //MSTL_SHARED_PTR_H /// 智能指针 像一个指针 template class shared_ptr{ public: T& operator*() const { return *px; } T* operator->() const { return px; } shared_ptr(T* p) : px(p) {} private: T* px; long* pn; };