auto_ptr 解释
来源:互联网 发布:爬虫 股票数据 编辑:程序博客网 时间:2024/05/21 12:39
template <class X> class auto_ptr;
Automatic Pointer
This class provides a limited garbage collection facility for pointers, by allowing pointers to have the elements they point to automatically destroyed when the auto_ptr object is itself destroyed.
auto_ptr objects have the peculiarity of taking ownership of the pointers assigned to them: An auto_ptr object that has ownership over one element is in charge of destroying the element it points to and to deallocate the memory allocated to it when itself is destroyed. The destructor does this by calling operator delete automatically.
Therefore, no two auto_ptr objects should own the same element, since both would try to destruct them at some point. When an assignment operation takes place between two auto_ptr objects, ownership is transferred, which means that the object losing ownership is reset to no longer point to the element (it is set to the null pointer).
Public members
还有部分资料mark下:
http://blog.csdn.net/xkyx_cn/archive/2009/03/05/3960569.aspx
http://www.cppblog.com/expter/archive/2009/03/29/78270.aspx
- auto_ptr 解释
- auto_ptr:
- Auto_ptr
- auto_ptr
- auto_ptr
- auto_ptr
- auto_ptr
- auto_ptr
- auto_ptr
- auto_ptr
- auto_ptr
- auto_ptr
- Auto_Ptr
- auto_ptr
- auto_ptr
- auto_ptr
- auto_ptr
- auto_ptr
- JavaScript window.opener的用法
- 关于cpu-z,everest,IntelCoreSeries的一些认识
- 库的学习
- 实验一、进程的创建和撤销
- 让旧版本Firefox扩展完美兼容新版浏览器的小技巧
- auto_ptr 解释
- MyEclipse 8.5 开发环境配置,汉化,Aptana2.0插件,SVN 插件,Flex Builder 3/4 插件安装
- oracle中函数和存储过程简单示例-动态sql
- Oracle在Linux操作系统下的安装小结
- 原来一天编写C语言太多真的会得C语言病的
- windows Message 说明
- mtk编译命令详解 及手机指令(转载)
- java调用存储过程和游标
- 关于"检测到有潜在危险的 Request.Form 值"报错的解决办法