std::terminate(); set_terminate ,产生异常会调用该函数,默认是调用abort
void handler()
{
cout << "error ~~~~~~~~~~~~~~~~~~";
}
std::set_terminate(handler);//默认调用abort
try
{
throw std::logic_error("logic error");
throw std::runtime_error("mem leack");
}
catch (std::exception e)
{
cout << e.what();
// abort();
std::terminate(); //终止处理异常
}
std::ref 强制转换为引用&
std::move 强制转换 右值引用&&
C++ 11
点赞
收藏