C++中的智能指針...

       智能指針就是智能,自動化地管理指針所指向的動態資源的釋放,那仫既然已經有了指針的概念那仫爲什仫還會有智能指針呢?請看下面一種場景安全      void fun() { int *ptr=new int(1); if(1) throw 1; delete ptr; } void test1() { try { fun(); } catch(...) { c
相關文章
相關標籤/搜索