summaryrefslogtreecommitdiff
path: root/boost/asio/handler_type.hpp
blob: 97187574b629190787015e214e26d23cd3a81428 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// handler_type.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef BOOST_ASIO_HANDLER_TYPE_HPP
#define BOOST_ASIO_HANDLER_TYPE_HPP

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#include <boost/asio/detail/config.hpp>
#include <boost/asio/detail/type_traits.hpp>

#include <boost/asio/detail/push_options.hpp>

namespace boost {
namespace asio {

/// (Deprecated: Use two-parameter version of async_result.) Default handler
/// type traits provided for all completion token types.
/**
 * The handler_type traits class is used for determining the concrete handler
 * type to be used for an asynchronous operation. It allows the handler type to
 * be determined at the point where the specific completion handler signature
 * is known.
 *
 * This template may be specialised for user-defined completion token types.
 */
template <typename CompletionToken, typename Signature, typename = void>
struct handler_type
{
  /// The handler type for the specific signature.
  typedef typename conditional<
    is_same<CompletionToken, typename decay<CompletionToken>::type>::value,
    decay<CompletionToken>,
    handler_type<typename decay<CompletionToken>::type, Signature>
  >::type::type type;
};

} // namespace asio
} // namespace boost

#include <boost/asio/detail/pop_options.hpp>

#endif // BOOST_ASIO_HANDLER_TYPE_HPP