forked from boostorg/exception
exception_ptr ctor for std::exception_ptr
This commit is contained in:
@ -40,6 +40,35 @@
|
|||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
|
namespace
|
||||||
|
exception_detail
|
||||||
|
{
|
||||||
|
#ifndef BOOST_NO_CXX11_HDR_EXCEPTION
|
||||||
|
struct
|
||||||
|
std_exception_ptr_wrapper
|
||||||
|
{
|
||||||
|
std::exception_ptr p;
|
||||||
|
explicit std_exception_ptr_wrapper( std::exception_ptr const & ptr ) BOOST_NOEXCEPT:
|
||||||
|
p(ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||||
|
explicit std_exception_ptr_wrapper( std::exception_ptr && ptr ) BOOST_NOEXCEPT:
|
||||||
|
p(static_cast<std::exception_ptr &&>(ptr))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
shared_ptr<exception_detail::clone_base const>
|
||||||
|
wrap_exception_ptr( std::exception_ptr const & e )
|
||||||
|
{
|
||||||
|
exception_detail::clone_base const & base =
|
||||||
|
boost::enable_current_exception(std_exception_ptr_wrapper(std::current_exception()));
|
||||||
|
return shared_ptr<exception_detail::clone_base const>(base.clone());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
class exception_ptr;
|
class exception_ptr;
|
||||||
namespace exception_detail { void rethrow_exception_( exception_ptr const & ); }
|
namespace exception_detail { void rethrow_exception_( exception_ptr const & ); }
|
||||||
|
|
||||||
@ -54,6 +83,12 @@ boost
|
|||||||
exception_ptr()
|
exception_ptr()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#ifndef BOOST_NO_CXX11_HDR_EXCEPTION
|
||||||
|
exception_ptr( std::exception_ptr const & e ):
|
||||||
|
ptr_(exception_detail::wrap_exception_ptr(e))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
explicit
|
explicit
|
||||||
exception_ptr( impl const & ptr ):
|
exception_ptr( impl const & ptr ):
|
||||||
ptr_(ptr)
|
ptr_(ptr)
|
||||||
@ -307,24 +342,6 @@ boost
|
|||||||
return boost::copy_exception(unknown_exception(e));
|
return boost::copy_exception(unknown_exception(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_NO_CXX11_HDR_EXCEPTION
|
|
||||||
struct
|
|
||||||
std_exception_ptr_wrapper
|
|
||||||
{
|
|
||||||
std::exception_ptr p;
|
|
||||||
explicit std_exception_ptr_wrapper( std::exception_ptr const & ptr ) BOOST_NOEXCEPT:
|
|
||||||
p(ptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
|
||||||
explicit std_exception_ptr_wrapper( std::exception_ptr && ptr ) BOOST_NOEXCEPT:
|
|
||||||
p(static_cast<std::exception_ptr &&>(ptr))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
exception_ptr
|
exception_ptr
|
||||||
current_exception_impl()
|
current_exception_impl()
|
||||||
@ -457,10 +474,7 @@ boost
|
|||||||
#ifndef BOOST_NO_CXX11_HDR_EXCEPTION
|
#ifndef BOOST_NO_CXX11_HDR_EXCEPTION
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// wrap the std::exception_ptr in a clone-enabled Boost.Exception object
|
return exception_ptr(std::current_exception());
|
||||||
exception_detail::clone_base const & base =
|
|
||||||
boost::enable_current_exception(std_exception_ptr_wrapper(std::current_exception()));
|
|
||||||
return exception_ptr(shared_ptr<exception_detail::clone_base const>(base.clone()));
|
|
||||||
}
|
}
|
||||||
catch(
|
catch(
|
||||||
...)
|
...)
|
||||||
|
Reference in New Issue
Block a user