在功能通话中的异常安全性
-
12-10-2019 - |
题
是呼吁 f()
异常安全?
inline std::auto_ptr<C> auto_new() {
return std::auto_ptr<C>(new C());
}
void f(std::auto_ptr<C> p1,
std::auto_ptr<C> p2);
// ...
{
f(auto_new(), auto_new());
}
换句话说,在第一和第二 auto_new()
功能调用如果两个函数在线?
解决方案
是的,这是例外的安全;不, inline
与调用表达式中保证的序列点没有区别。
不隶属于 StackOverflow