什么时候可以从C ++中的析构函数抛出异常? [英] When is it OK to throw an exception from a destructor in C++?
本文介绍了什么时候可以从C ++中的析构函数抛出异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
只是不要这样做。
如果星星和行星按照您需要的方式对齐...
仍然不要这样做。
I know the rule is to NEVER throw one during a destructor, and I understand why. I would not dare do it. But even the C++ Faq Lite says that this rule is good 99% of the time. What is the other 1% that they fail to delve into?
Link to the C++ Faq Lite bullet point on throwing from ~():
解决方案
Just don't do it. If the stars and planets align in such a way that you find you need to...
Still don't do it.
这篇关于什么时候可以从C ++中的析构函数抛出异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文