Add throw_exception_from_error overload for std::exception_ptr

This commit is contained in:
Peter Dimov committed 2022-02-18 02:55:34 +02:00
1 parent 00c71cf388
commit 6d7a57a970
2 files changed
+73

No files matched your search

+13
View File
@@ -18,6 +18,7 @@
#include <utility>
#include <iosfwd>
#include <system_error>
#include <exception>
//
@@ -53,6 +54,18 @@ BOOST_NORETURN BOOST_NOINLINE inline void throw_exception_from_error( std::errc
boost::throw_with_location( std::system_error( make_error_code( e ) ), loc );
}
BOOST_NORETURN BOOST_NOINLINE inline void throw_exception_from_error( std::exception_ptr const & p, boost::source_location const& loc )
{
if( p )
{
std::rethrow_exception( p );
}
else
{
boost::throw_with_location( std::bad_exception(), loc );
}
}
#if defined(__GNUC__) && __GNUC__ >= 7 && __GNUC__ <= 8
# pragma GCC diagnostic pop
#endif