Compare commits

..

7 Commits

3 changed files with 49 additions and 1 deletions

View File

@ -2,6 +2,9 @@
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
# Partial (add_subdirectory only) and experimental CMake support
# Subject to change; please do not rely on the contents of this file yet
cmake_minimum_required(VERSION 3.5)
project(BoostThrowException LANGUAGES CXX)

View File

@ -472,6 +472,51 @@ boost
{
return exception_detail::clone_impl<T>(x);
}
template <class T>
struct
BOOST_SYMBOL_VISIBLE
wrapexcept:
public exception_detail::clone_impl<typename exception_detail::enable_error_info_return_type<T>::type>
{
typedef exception_detail::clone_impl<typename exception_detail::enable_error_info_return_type<T>::type> base_type;
public:
explicit
wrapexcept( typename exception_detail::enable_error_info_return_type<T>::type const & x ):
base_type( x )
{
}
~wrapexcept() throw()
{
}
};
namespace
exception_detail
{
template <class T>
struct
remove_error_info_injector
{
typedef T type;
};
template <class T>
struct
remove_error_info_injector< error_info_injector<T> >
{
typedef T type;
};
template <class T>
inline
wrapexcept<typename remove_error_info_injector<T>::type>
enable_both( T const & x )
{
return wrapexcept<typename remove_error_info_injector<T>::type>( enable_error_info( x ) );
}
}
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)

View File

@ -67,7 +67,7 @@ template<class E> 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