Do all boost exceptions derive from std::exception? If not do they all derive from some base exception class?
According to the documentation boost::exception
doesn't inherit std::exception
.
The FAQ explains why.
However this page explains how to correctly use Boost exceptions.
A "good Boost citizen" library should throw using boost::throw_exception
, in order to support configurations where exception handling is disabled.
The boost::throw_exception
function requires that the type of the passed exception derives publicly from std::exception
(as of version 1.37.0 or thereabouts boost::throw_exception
will issue a compile error if that requirement is not met.) In addition and by default, exceptions emitted using boost::throw_exception
derive from boost::exception
.
However, there is no requirement for Boost libraries to throw exceptions through boost:throw_exception
or to derive from std::exception
.
I believe so. Can't think of a boost library throwing something non-std::exception based.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With