Item 9:Use destructors to prevent resource leaks. (More Effective C++)
摘要:
The solution is to replace the pointer pa with an object that acts like a pointer. That way, when the pointer-like object is (automatically) destroyed, we can have its destructor call delete. Objects that act like pointers, but do more, are called smart pointers, and, as Item 28 explains, you can m. 阅读全文
posted @ 2011-06-14 14:41 Ray Z 阅读(186) 评论(0) 推荐(0)