智能指针小问题
来源:百度知道 编辑:UC知道 时间:2024/05/31 13:36:51
auto_ptr<string> c(new string("Hello world"));
auto_ptr<string> d=c;
cout<<*c<<endl;
cout<<*d<<endl;
这样出来的结果为什么还是
Hello world
Hello world
auto_ptr<string> d=c;
这样之后,c应该是未绑定的才对??
auto_ptr<string> d=c;
cout<<*c<<endl;
cout<<*d<<endl;
这样出来的结果为什么还是
Hello world
Hello world
auto_ptr<string> d=c;
这样之后,c应该是未绑定的才对??
你确定是这样的? 。。 你用什么编译器试的? 周围有没有什么别的代码?
你给理解反了...
如果给别人赋值就得把自己释放那程序还怎么写啊。
C++的,刚开始学习,还看不懂