Warning, file /include/boost/asio/detail/completion_message.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_DETAIL_COMPLETION_MESSAGE_HPP
0012 #define BOOST_ASIO_DETAIL_COMPLETION_MESSAGE_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <tuple>
0020 #include <boost/asio/detail/type_traits.hpp>
0021 #include <boost/asio/detail/utility.hpp>
0022
0023 #include <boost/asio/detail/push_options.hpp>
0024
0025 namespace boost {
0026 namespace asio {
0027 namespace detail {
0028
0029 template <typename Signature>
0030 class completion_message;
0031
0032 template <typename R>
0033 class completion_message<R()>
0034 {
0035 public:
0036 completion_message(int)
0037 {
0038 }
0039
0040 template <typename Handler>
0041 void receive(Handler& handler)
0042 {
0043 static_cast<Handler&&>(handler)();
0044 }
0045 };
0046
0047 template <typename R, typename Arg0>
0048 class completion_message<R(Arg0)>
0049 {
0050 public:
0051 template <typename T0>
0052 completion_message(int, T0&& t0)
0053 : arg0_(static_cast<T0&&>(t0))
0054 {
0055 }
0056
0057 template <typename Handler>
0058 void receive(Handler& handler)
0059 {
0060 static_cast<Handler&&>(handler)(
0061 static_cast<arg0_type&&>(arg0_));
0062 }
0063
0064 private:
0065 typedef decay_t<Arg0> arg0_type;
0066 arg0_type arg0_;
0067 };
0068
0069 template <typename R, typename Arg0, typename Arg1>
0070 class completion_message<R(Arg0, Arg1)>
0071 {
0072 public:
0073 template <typename T0, typename T1>
0074 completion_message(int, T0&& t0, T1&& t1)
0075 : arg0_(static_cast<T0&&>(t0)),
0076 arg1_(static_cast<T1&&>(t1))
0077 {
0078 }
0079
0080 template <typename Handler>
0081 void receive(Handler& handler)
0082 {
0083 static_cast<Handler&&>(handler)(
0084 static_cast<arg0_type&&>(arg0_),
0085 static_cast<arg1_type&&>(arg1_));
0086 }
0087
0088 private:
0089 typedef decay_t<Arg0> arg0_type;
0090 arg0_type arg0_;
0091 typedef decay_t<Arg1> arg1_type;
0092 arg1_type arg1_;
0093 };
0094
0095 template <typename R, typename... Args>
0096 class completion_message<R(Args...)>
0097 {
0098 public:
0099 template <typename... T>
0100 completion_message(int, T&&... t)
0101 : args_(static_cast<T&&>(t)...)
0102 {
0103 }
0104
0105 template <typename Handler>
0106 void receive(Handler& h)
0107 {
0108 this->do_receive(h, boost::asio::detail::index_sequence_for<Args...>());
0109 }
0110
0111 private:
0112 template <typename Handler, std::size_t... I>
0113 void do_receive(Handler& h, boost::asio::detail::index_sequence<I...>)
0114 {
0115 static_cast<Handler&&>(h)(
0116 std::get<I>(static_cast<args_type&&>(args_))...);
0117 }
0118
0119 typedef std::tuple<decay_t<Args>...> args_type;
0120 args_type args_;
0121 };
0122
0123 }
0124 }
0125 }
0126
0127 #include <boost/asio/detail/pop_options.hpp>
0128
0129 #endif