您的位置:首页 > 移动开发 > Objective-C

Item 13: Use objects to manage resources.(Effective C++)

2010-01-05 22:09 531 查看
To prevent resource leaks, use RAII objects that acquire
resources in their constructors and release them in their destructors.

Two commonly useful RAII classes are TR1::shared_ptr
and auto_ptr. tr1::shared_ptr is usually the better choice,
because its behavior when copied is intuitive. Copying an auto_ptr sets
it to null.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: