]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // |
2 | // detail/throw_exception.hpp | |
3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
4 | // | |
5 | // Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com) | |
6 | // | |
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
9 | // | |
10 | ||
11 | #ifndef BOOST_ASIO_DETAIL_THROW_EXCEPTION_HPP | |
12 | #define BOOST_ASIO_DETAIL_THROW_EXCEPTION_HPP | |
13 | ||
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) | |
15 | # pragma once | |
16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) | |
17 | ||
18 | #include <boost/asio/detail/config.hpp> | |
19 | ||
20 | #if defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION) | |
21 | # include <boost/throw_exception.hpp> | |
22 | #endif // defined(BOOST_ASIO_BOOST_THROW_EXCEPTION) | |
23 | ||
24 | namespace boost { | |
25 | namespace asio { | |
26 | namespace detail { | |
27 | ||
28 | #if defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION) | |
29 | using boost::throw_exception; | |
30 | #else // defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION) | |
31 | ||
32 | // Declare the throw_exception function for all targets. | |
33 | template <typename Exception> | |
34 | void throw_exception(const Exception& e); | |
35 | ||
36 | // Only define the throw_exception function when exceptions are enabled. | |
37 | // Otherwise, it is up to the application to provide a definition of this | |
38 | // function. | |
39 | # if !defined(BOOST_ASIO_NO_EXCEPTIONS) | |
40 | template <typename Exception> | |
41 | void throw_exception(const Exception& e) | |
42 | { | |
43 | throw e; | |
44 | } | |
45 | # endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) | |
46 | ||
47 | #endif // defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION) | |
48 | ||
49 | } // namespace detail | |
50 | } // namespace asio | |
51 | } // namespace boost | |
52 | ||
53 | #endif // BOOST_ASIO_DETAIL_THROW_EXCEPTION_HPP |