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