Prefer using std::current_exception when available (refs #42)

This commit is contained in:
Peter Dimov
2022-01-26 01:12:54 +02:00
parent 941754ed23
commit eafe6dbd5c

View File

@ -385,6 +385,9 @@ boost
{ {
return exception_ptr(shared_ptr<exception_detail::clone_base const>(e.clone())); return exception_ptr(shared_ptr<exception_detail::clone_base const>(e.clone()));
} }
#ifdef BOOST_NO_CXX11_HDR_EXCEPTION
catch( catch(
std::domain_error & e ) std::domain_error & e )
{ {
@ -457,19 +460,19 @@ boost
{ {
return exception_detail::current_exception_std_exception(e); return exception_detail::current_exception_std_exception(e);
} }
#ifdef BOOST_NO_CXX11_HDR_EXCEPTION
// this case can be handled losslesly with std::current_exception() (see below)
catch( catch(
std::exception & e ) std::exception & e )
{ {
return exception_detail::current_exception_unknown_std_exception(e); return exception_detail::current_exception_unknown_std_exception(e);
} }
#endif
catch( catch(
boost::exception & e ) boost::exception & e )
{ {
return exception_detail::current_exception_unknown_boost_exception(e); return exception_detail::current_exception_unknown_boost_exception(e);
} }
#endif // #ifdef BOOST_NO_CXX11_HDR_EXCEPTION
catch( catch(
... ) ... )
{ {