PageRenderTime 41ms CodeModel.GetById 37ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/asio/detail/handler_invoke_helpers.hpp

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