關於std::shared_ptr與std::enable_shared_from_this循環引用致使的問題

自從C++11有了std::shared_ptr這樣的智能指針,做爲C++程序只要將一個堆上的類對象用std::shared_ptr包裹一下就能夠作到內存自動釋放了。看一個例子:函數 #include "stdafx.h" #include <memory> class A { public: A() { m_i = 9; } ~A()
相關文章
相關標籤/搜索