The relationship between boost :: exception and std :: exception

Suppose the following code exists:

try {
      // Do some boost stuff here
}
catch (const std::exception & stdEx) {
     cout << stdEx.what() << endl;
}

Questions:

1) I know that the code works for some forced exceptions, although std :: exception and boost :: exception do not belong to the same inheritance path. Why does it work?

2) Does this work for all forced exceptions? In other words, are there any examples where the boost :: exception handler can be launched that is below the std :: exception handler?

+4
source share
1 answer

As you said, it boost::exceptiondoesn’t work out std::exception. For this reason, check the relevant FAQ :

, , ( , ) std::exception.

boost::exception std::exception, enable_error_info , catch(std::exception &).

, boost::exception std::exception . std::exception (, , ).

, () boost::exception std::exception, boost::exception.

std::exception (, boost::bad_lexical_cast), (, boost::xpressive::regex_error). , boost::exception, , , std::exception .

+6

All Articles