谢谢,这个链接讲得也很好:
https://stackoverflow.com/questions/2321511/what-is-meant-by-resource-acquisition-is-initialization-raii
其中Sebastian Redl的一个评论比较有意思:
If you do 'new Foo' and Foo's constructor throws, the language WILL reclaim the memory. If you allocate memory in a constructor and provide no means for releasing it other than the destructor, then the language won't reclaim it if you throw later in the constructor. But then, you should have immediately wrapped every allocation in an RAII object anyway.
【 在 billyhq 的大作中提到: 】
: 这里解释了:
https://www.cnblogs.com/weiyouqing/p/14623592.html: 还有就是构造函数里面抛异常不太好排查
--
修改:cjohny FROM 216.240.30.*
FROM 216.240.30.*