• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 Peter Dimov
2 // Distributed under the Boost Software License, Version 1.0.
3 // http://www.boost.org/LICENSE_1_0.txt
4 
5 #if defined(_MSC_VER)
6 # pragma warning(disable: 4702) // unreachable code
7 # pragma warning(disable: 4577) // noexcept used without /EHsc
8 #endif
9 
10 #define BOOST_EXCEPTION_DISABLE
11 
12 //#include <boost/exception_ptr.hpp>
13 
14 #include <boost/throw_exception.hpp>
15 #include <boost/exception/exception.hpp>
16 #include <boost/shared_ptr.hpp>
17 #include <boost/make_shared.hpp>
18 
19 typedef boost::shared_ptr<boost::exception_detail::clone_base const> exception_ptr;
20 
make_exception_ptr(E const & e)21 template<class E> exception_ptr make_exception_ptr( E const& e )
22 {
23     return boost::make_shared< boost::wrapexcept<E> >( e );
24 }
25 
26 class my_exception: public std::exception {};
27 
main()28 int main()
29 {
30     ::make_exception_ptr( my_exception() );
31 }
32 
33 namespace boost
34 {
35 
36 // shared_ptr needs this
throw_exception(std::exception const &)37 void throw_exception( std::exception const & )
38 {
39     std::exit( 1 );
40 }
41 
42 } // namespace boost
43