void f(){
auto_ptr<string> ap(new string("异常安全,即使f()函数没有来得及运行string的析构函数"));
}
本文探讨了异常安全的概念,并通过使用auto_ptr类展示了如何确保在函数未完全执行时对象的正确销毁。
void f(){
auto_ptr<string> ap(new string("异常安全,即使f()函数没有来得及运行string的析构函数"));
}
677
3826
1841

被折叠的 条评论
为什么被折叠?