轉:學習筆記:shared_ptr陷阱

如下文章轉載自:http://blog.sina.com.cn/s/blog_6a6d5ba801012jt5.html ,致謝!!!html 條款1:不要把一個原生指針給多個shared_ptr管理 int* ptr = new int; shared_ptr<int> p1(ptr); shared_ptr<int> p2(ptr); //logic error ptr對象被刪除了2次 這種問
相關文章
相關標籤/搜索