Posted on 2012-11-27 10:03 魏尚堂
阅读(63) 评论(0) 编辑 收藏 引用
Perform every resource allocation (e.g., new) in its own code statement which immediately gives the new resource to a manager object (e.g., auto_ptr).
This guideline is easy to understand and remember, it neatly avoids all of the exception safety problems in the original problem, and by mandating the use of manager objects it helps to avoid many other exception safety problems as well. This guideline is a good candidate for inclusion in your team's coding standards
file I/O http://www.zwqxin.com/archives/cpp/use-sstream.html