千呼万唤始出来 上一篇《从auto_ptr说起》中详细的总结了C++98标准中的auto_ptr,但是随着C++11的到来,auto_ptr已经不再了,即将成为历史;好的东西总是会受到大家的欢迎的,随着大家都在使用“准”标准库boost中的shared_ptr;C++标准委员会终于觉的是时候将shared_ptr加入到C++11中去了。欢呼声一片,至少我是这么觉的了;至少shared_ptr让我用起来,还是不错的。接下来,就总结一下C++11中的这些智能指针吧。 C++11有哪些智能指针先来一段简单的代码,看看C++11中到底有哪些智能指针。 /*************************************************************************> File Name: SmartPointDemo.cpp> Author: Jelly> Mail: vipygd#126.com(#->@)> Created Time: 2014年10月16日 星期四 15时25分43秒************************************************************************/#include #include using namespace std;int main(){ unique_ptr up1(new int(10)); // 不能复制的unique_ptr // unique_ptr up2 = up1; // 这样是错的 cout |