2 // detail/handler_invoke_helpers.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
11 #ifndef BOOST_ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP
12 #define BOOST_ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/detail/addressof.hpp>
20 #include <boost/asio/handler_invoke_hook.hpp>
22 #include <boost/asio/detail/push_options.hpp>
24 // Calls to asio_handler_invoke must be made from a namespace that does not
25 // contain overloads of this function. The boost_asio_handler_invoke_helpers
26 // namespace is defined here for that purpose.
27 namespace boost_asio_handler_invoke_helpers {
29 template <typename Function, typename Context>
30 inline void invoke(Function& function, Context& context)
32 #if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
33 Function tmp(function);
36 using boost::asio::asio_handler_invoke;
37 asio_handler_invoke(function, boost::asio::detail::addressof(context));
41 template <typename Function, typename Context>
42 inline void invoke(const Function& function, Context& context)
44 #if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
45 Function tmp(function);
48 using boost::asio::asio_handler_invoke;
49 asio_handler_invoke(function, boost::asio::detail::addressof(context));
53 } // namespace boost_asio_handler_invoke_helpers
55 #include <boost/asio/detail/pop_options.hpp>
57 #endif // BOOST_ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP