From 56dd1c41115ab81e09fa46c3977d039fdea49cc6 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 27 Sep 2018 07:39:18 +0300 Subject: [PATCH] Add/use exception_detail::enable_both --- include/boost/exception/exception.hpp | 12 ++++++++++++ include/boost/throw_exception.hpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index be70b3c..1460473 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -472,6 +472,18 @@ boost { return exception_detail::clone_impl(x); } + + namespace + exception_detail + { + template + inline + clone_impl::type> + enable_both( T const & x ) + { + return enable_current_exception( 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