posts - 62,  comments - 19,  trackbacks - 0
解释auto_ptr



#include <iostream>
#include <memory>
using namespace std;

int main()
{
        auto_ptr<int> pi ( new int(1024) );
        cout << *pi << endl;
        return 0;
}
回答:

auto_ptr是C++标准库提供的类模板,它可以帮助程序员自动管理用new表达式动态分配的单个对象。当auto_ptr对象的生命期结束时,动态分配的对象被自动释放。


















posted on 2006-11-10 14:06 乔栋 阅读(290) 评论(0)  编辑 收藏 引用 所属分类: C++的健身房
<2007年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

常用链接

留言簿(6)

随笔分类

随笔档案

文章分类

文章档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜


My blog is worth $0.00.
How much is your blog worth?