Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/160.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何捕捉任何c++;标准例外? 我知道C++中可以用< /P>捕获任何数据类型的异常。 try { // throw exception here } catch (...) { // handle exception here }_C++_Exception Handling - Fatal编程技术网

如何捕捉任何c++;标准例外? 我知道C++中可以用< /P>捕获任何数据类型的异常。 try { // throw exception here } catch (...) { // handle exception here }

如何捕捉任何c++;标准例外? 我知道C++中可以用< /P>捕获任何数据类型的异常。 try { // throw exception here } catch (...) { // handle exception here },c++,exception-handling,C++,Exception Handling,如何捕捉任何c++;标准例外? 我知道C++中可以用< /P>捕获任何数据类型的异常。 try { // throw exception here } catch (...) { // handle exception here } >但我想捕获任何C++标准异常,例如 STD::LogICHOrrule, STD::OXION OFFINEX ,而不是其他数据类型,如 String < /C> >或 int >代码>。如何才能只捕获C++标准异常?我想调用传入的C+

如何捕捉任何c++;标准例外?

我知道C++中可以用< /P>捕获任何数据类型的异常。

try {
  // throw exception here
} catch (...) {
  // handle exception here
}

<> >但我想捕获任何C++标准异常,例如<代码> STD::LogICHOrrule,<代码> STD::OXION OFFINEX ,而不是其他数据类型,如<代码> String < /C> >或<代码> int >代码>。如何才能只捕获C++标准异常?我想调用传入的C++标准异常对象的代码> ExpWord[/]代码,这是不可能的,使用以上代码。

< P>所有标准异常都是从<>代码STD::异常< /代码>中得到的,所以请注意:
try {
    // throw exception here
}
catch (const std::exception &e) {
    // handle exception here
}
.