考虑一个带有副作用的复制构造函数的异常类。
编译器可以在这里跳过调用复制构造函数吗:
try {
throw ugly_exception();
}
catch(ugly_exception) // ignoring the exception, so I'm not naming it
{ }
那这个呢:
try {
something_that_throws_ugly_exception();
}
catch(ugly_exception) // ignoring the exception, so I'm not naming it
{ }
(是的,我知道这一切都很丑陋,这是受另一个问题的启发)