什么时候可以从C ++中的析构函数抛出异常? [英] When is it OK to throw an exception from a destructor in C++?
本文介绍了什么时候可以从C ++中的析构函数抛出异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道规则是在析构函数中不要抛出一个,我明白为什么。我不敢做。但即使是C ++ Faq Lite说这个规则在99%的时间是好的。他们没有钻研的其他1%是什么?
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?
推荐答案
p>只是不要这样做。
如果星星和行星以这样的方式排列,你发现你需要...
Just don't do it. If the stars and planets align in such a way that you find you need to...
仍然不这样做。
这篇关于什么时候可以从C ++中的析构函数抛出异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文