diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index be70b3c..d5c22c4 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -472,6 +472,51 @@ boost { return exception_detail::clone_impl(x); } + + template + struct + BOOST_SYMBOL_VISIBLE + wrapexcept: + public exception_detail::clone_impl::type> + { + typedef exception_detail::clone_impl::type> base_type; + public: + explicit + wrapexcept( typename exception_detail::enable_error_info_return_type::type const & x ): + base_type( x ) + { + } + + ~wrapexcept() throw() + { + } + }; + + namespace + exception_detail + { + template + struct + remove_error_info_injector + { + typedef T type; + }; + + template + struct + remove_error_info_injector< error_info_injector > + { + typedef T type; + }; + + template + inline + wrapexcept::type> + enable_both( T const & x ) + { + return wrapexcept::type>( enable_error_info( x ) ); + } + } } #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index a96dded..c6623e1 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -67,7 +67,7 @@ template BOOST_NORETURN inline void throw_exception( E const & e ) throw_exception_assert_compatibility(e); #ifndef BOOST_EXCEPTION_DISABLE - throw enable_current_exception(enable_error_info(e)); + throw exception_detail::enable_both( e ); #else throw e; #endif