1 // 2 // detail/throw_exception.hpp 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2015 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 ASIO_DETAIL_THROW_EXCEPTION_HPP 12 #define ASIO_DETAIL_THROW_EXCEPTION_HPP 13 14 15 #include "asio/detail/config.hpp" 16 17 18 namespace asio { 19 namespace detail { 20 21 22 // Declare the throw_exception function for all targets. 23 template <typename Exception> 24 void throw_exception(const Exception& e); 25 26 // Only define the throw_exception function when exceptions are enabled. 27 // Otherwise, it is up to the application to provide a definition of this 28 // function. 29 # if !defined(ASIO_NO_EXCEPTIONS) 30 template <typename Exception> throw_exception(const Exception & e)31void throw_exception(const Exception& e) 32 { 33 throw e; 34 } 35 # endif // !defined(ASIO_NO_EXCEPTIONS) 36 37 38 } // namespace detail 39 } // namespace asio 40 41 #endif // ASIO_DETAIL_THROW_EXCEPTION_HPP 42