]> git.lyx.org Git - lyx.git/blob - boost/boost/throw_exception.hpp
update boost to version 1.36
[lyx.git] / boost / boost / throw_exception.hpp
1 #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED
2 #define BOOST_THROW_EXCEPTION_HPP_INCLUDED
3
4 // MS compatible compilers support #pragma once
5
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
7 # pragma once
8 #endif
9
10 //
11 //  boost/throw_exception.hpp
12 //
13 //  Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
14 //  Copyright (c) 2008 Emil Dotchevski and Reverge Studios, Inc.
15 //
16 //  Distributed under the Boost Software License, Version 1.0. (See
17 //  accompanying file LICENSE_1_0.txt or copy at
18 //  http://www.boost.org/LICENSE_1_0.txt)
19 //
20 //  http://www.boost.org/libs/utility/throw_exception.html
21 //
22
23 #include <boost/config.hpp>
24 #include <boost/detail/workaround.hpp>
25 #include <exception>
26
27 #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_NO_TYPEID )
28 # define BOOST_EXCEPTION_DISABLE
29 #endif
30
31 #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, < 0x590 )
32 # define BOOST_EXCEPTION_DISABLE
33 #endif
34
35 #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1310 )
36 # define BOOST_EXCEPTION_DISABLE
37 #endif
38
39 #if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
40 # include <boost/exception/enable_current_exception.hpp>
41 # include <boost/exception/enable_error_info.hpp>
42 #endif
43
44 namespace boost
45 {
46
47 #ifdef BOOST_NO_EXCEPTIONS
48
49 void throw_exception( std::exception const & e ); // user defined
50
51 #else
52
53 inline void throw_exception_assert_compatibility( std::exception const & ) { }
54
55 template<class E> inline void throw_exception( E const & e )
56 {
57     //All boost exceptions are required to derive std::exception,
58     //to ensure compatibility with BOOST_NO_EXCEPTIONS.
59     throw_exception_assert_compatibility(e);
60
61 #ifndef BOOST_EXCEPTION_DISABLE
62     throw enable_current_exception(enable_error_info(e));
63 #else
64     throw e;
65 #endif
66 }
67
68 #endif
69
70 } // namespace boost
71
72 #endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED