C++智能指針使用須知

我在《C++ 智能指針(shared_ptr/weak_ptr)源碼分析》已經介紹了智能指針的一些使用注意點,本文在此基礎上,基於C++11中的語法特性,介紹一些智能指針的使用須知。 std::unique_ptr 如果不需要共享,同時需要防止內存泄漏, std::unique_ptr是替代raw pointer(裸指針)的第一選擇:它的大小和raw pointer一樣,解引用的速度也和raw p
相關文章
相關標籤/搜索