PageRenderTime 17ms CodeModel.GetById 7ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/src/contrib/boost/asio/detail/handler_invoke_helpers.hpp

http://pythonocc.googlecode.com/
C++ Header | 49 lines | 27 code | 10 blank | 12 comment | 2 complexity | 8f86204f34fab3851bc521e710cfde8e MD5 | raw file
 1//
 2// handler_invoke_helpers.hpp
 3// ~~~~~~~~~~~~~~~~~~~~~~~~~~
 4//
 5// Copyright (c) 2003-2010 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_HANDLER_INVOKE_HELPERS_HPP
12#define BOOST_ASIO_DETAIL_HANDLER_INVOKE_HELPERS_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/push_options.hpp>
19
20#include <boost/asio/detail/push_options.hpp>
21#include <boost/detail/workaround.hpp>
22#include <boost/utility/addressof.hpp>
23#include <boost/asio/detail/pop_options.hpp>
24
25#include <boost/asio/handler_invoke_hook.hpp>
26
27// Calls to asio_handler_invoke must be made from a namespace that does not
28// contain overloads of this function. The boost_asio_handler_invoke_helpers
29// namespace is defined here for that purpose.
30namespace boost_asio_handler_invoke_helpers {
31
32template <typename Function, typename Context>
33inline void invoke(const Function& function, Context& context)
34{
35#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \
36  || BOOST_WORKAROUND(__GNUC__, < 3)
37  Function tmp(function);
38  tmp();
39#else
40  using namespace boost::asio;
41  asio_handler_invoke(function, boost::addressof(context));
42#endif
43}
44
45} // namespace boost_asio_handler_invoke_helpers
46
47#include <boost/asio/detail/pop_options.hpp>
48
49#endif // BOOST_ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP