From 322d7611af7d745e2ab358b589c0904a28575635 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 27 Sep 2018 08:13:59 +0300 Subject: [PATCH] Use boost::wrapexcept as the thrown exception type --- include/boost/exception/exception.hpp | 37 +++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index 1460473..d5c22c4 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -473,15 +473,48 @@ 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 - clone_impl::type> + wrapexcept::type> enable_both( T const & x ) { - return enable_current_exception( enable_error_info( x ) ); + return wrapexcept::type>( enable_error_info( x ) ); } } }