Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/141.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++ boost异常_C++_Exception_Boost_Exception Handling - Fatal编程技术网

C++ boost异常

C++ boost异常,c++,exception,boost,exception-handling,C++,Exception,Boost,Exception Handling,所有的boost异常都来自std::exception吗?如果不是,它们是否都来自某个基本异常类?我相信是这样。无法想象boost库会抛出非基于std::exception的内容。根据boost::exception的说法,它不会继承std::exception 这就解释了原因 但是,解释了如何正确使用Boost异常。为了支持禁用异常处理的配置,“良好的Boost公民”库应该使用Boost::throw_exception抛出 boost::throw_exception函数要求传递的异常类型从

所有的boost异常都来自std::exception吗?如果不是,它们是否都来自某个基本异常类?

我相信是这样。无法想象boost库会抛出非基于std::exception的内容。

根据
boost::exception
的说法,它不会继承
std::exception

这就解释了原因

但是,解释了如何正确使用Boost异常。

为了支持禁用异常处理的配置,“良好的Boost公民”库应该使用
Boost::throw_exception
抛出

boost::throw_exception
函数要求传递的异常类型从
std::exception
公开派生(从1.37.0版或其左右版本开始,
boost::throw_exception
将在未满足该要求时发出编译错误),使用
boost::throw\u exception
发出的异常源自
boost::exception


但是,Boost库不需要通过
Boost:throw_exception
抛出异常,也不需要从
std::exception

Boost派生异常。exception是可存储和可重复抛出异常的框架。它们不是直接从任何boost库中抛出的。常见问题解答解释了为什么
boost::exception
没有继承自
std::exception