Ray's playground

 

2011年3月23日

Item 17: Store newed objects in smart pointers in standalone statements.(Effective C++)

摘要: Store newed objects in smart pointers in standalone statements. Failure to do this can lead to subtle resource leaks when exceptions are thrown. 阅读全文

posted @ 2011-03-23 21:52 Ray Z 阅读(203) 评论(0) 推荐(0) 编辑

Item 16: Use the same form in corresponding uses of new and delete.(Effective C++)

摘要: If you use [] in a new expression, you must use [] in the corresponding delete expression. If you don't use [] in a new expression, you mustn't use [] in the corresponding delete expression. 阅读全文

posted @ 2011-03-23 21:29 Ray Z 阅读(202) 评论(0) 推荐(0) 编辑

Item 15: Provide access to raw resources in resource-managing classes.(Effective C++)

摘要: APIs often require access to raw resources, so each RAII class should offer a way to get at the resource it manages. Access may be via explicit conversion or implicit conversion. In general, explicit conversion is safer, but implicit conversion is more convenient for clients.1#include<iostream> 阅读全文

posted @ 2011-03-23 21:06 Ray Z 阅读(222) 评论(0) 推荐(0) 编辑

导航