]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/experimental/impl/deferred.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / experimental / impl / deferred.hpp
1 //
2 // experimental/impl/deferred.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2022 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_EXPERIMENTAL_IMPL_DEFERRED_HPP
12 #define BOOST_ASIO_EXPERIMENTAL_IMPL_DEFERRED_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 namespace boost {
21 namespace asio {
22
23 #if !defined(GENERATING_DOCUMENTATION)
24
25 template <typename R, typename... Args>
26 class async_result<
27 experimental::detail::deferred_signature_probe, R(Args...)>
28 {
29 public:
30 typedef experimental::detail::deferred_signature_probe_result<void(Args...)>
31 return_type;
32
33 template <typename Initiation, typename... InitArgs>
34 static return_type initiate(
35 BOOST_ASIO_MOVE_ARG(Initiation),
36 experimental::detail::deferred_signature_probe,
37 BOOST_ASIO_MOVE_ARG(InitArgs)...)
38 {
39 return return_type{};
40 }
41 };
42
43 template <typename Signature>
44 class async_result<experimental::deferred_t, Signature>
45 {
46 public:
47 template <typename Initiation, typename... InitArgs>
48 static experimental::deferred_async_operation<
49 Signature, Initiation, InitArgs...>
50 initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation,
51 experimental::deferred_t, BOOST_ASIO_MOVE_ARG(InitArgs)... args)
52 {
53 return experimental::deferred_async_operation<
54 Signature, Initiation, InitArgs...>(
55 experimental::deferred_init_tag{},
56 BOOST_ASIO_MOVE_CAST(Initiation)(initiation),
57 BOOST_ASIO_MOVE_CAST(InitArgs)(args)...);
58 }
59 };
60
61 template <typename Function, typename R, typename... Args>
62 class async_result<
63 experimental::deferred_function<Function>, R(Args...)>
64 {
65 public:
66 template <typename Initiation, typename... InitArgs>
67 static auto initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation,
68 experimental::deferred_function<Function> token,
69 BOOST_ASIO_MOVE_ARG(InitArgs)... init_args)
70 {
71 return experimental::deferred_sequence<
72 experimental::deferred_async_operation<
73 R(Args...), Initiation, InitArgs...>,
74 Function>(experimental::deferred_init_tag{},
75 experimental::deferred_async_operation<
76 R(Args...), Initiation, InitArgs...>(
77 experimental::deferred_init_tag{},
78 BOOST_ASIO_MOVE_CAST(Initiation)(initiation),
79 BOOST_ASIO_MOVE_CAST(InitArgs)(init_args)...),
80 BOOST_ASIO_MOVE_CAST(Function)(token.function_));
81 }
82 };
83
84 template <template <typename, typename> class Associator,
85 typename Handler, typename Tail, typename DefaultCandidate>
86 struct associator<Associator,
87 experimental::detail::deferred_sequence_handler<Handler, Tail>,
88 DefaultCandidate>
89 : Associator<Handler, DefaultCandidate>
90 {
91 static typename Associator<Handler, DefaultCandidate>::type get(
92 const experimental::detail::deferred_sequence_handler<Handler, Tail>& h,
93 const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
94 {
95 return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
96 }
97 };
98
99 #endif // !defined(GENERATING_DOCUMENTATION)
100
101 } // namespace asio
102 } // namespace boost
103
104 #include <boost/asio/detail/pop_options.hpp>
105
106 #endif // BOOST_ASIO_EXPERIMENTAL_IMPL_DEFERRED_HPP