摘要: 示例代码 #include <iostream> #include <memory> using namespace std; class base { public: ~base(){cout << "in ~base()" << endl;}; }; void fuc(base* pb) { c 阅读全文
posted @ 2021-04-21 13:44 刘大侠GG_B 阅读(89) 评论(0) 推荐(0) 编辑
摘要: share_ptr智能指针能够记录其实际的指向对象的类型,并正确的析构该对象。 所以使用share_ptr来管理的对象不需要虚析构函数 示例代码 #include <iostream> #include <memory> using namespace std; class base{ public 阅读全文
posted @ 2021-04-21 10:55 刘大侠GG_B 阅读(142) 评论(0) 推荐(0) 编辑