File indexing completed on 2025-01-30 09:33:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_AS_TUPLE_HPP
0012 #define BOOST_ASIO_AS_TUPLE_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 <boost/asio/detail/type_traits.hpp>
0020
0021 #include <boost/asio/detail/push_options.hpp>
0022
0023 namespace boost {
0024 namespace asio {
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 template <typename CompletionToken>
0035 class as_tuple_t
0036 {
0037 public:
0038
0039
0040 struct default_constructor_tag {};
0041
0042
0043
0044
0045
0046
0047
0048
0049 constexpr as_tuple_t(
0050 default_constructor_tag = default_constructor_tag(),
0051 CompletionToken token = CompletionToken())
0052 : token_(static_cast<CompletionToken&&>(token))
0053 {
0054 }
0055
0056
0057 template <typename T>
0058 constexpr explicit as_tuple_t(
0059 T&& completion_token)
0060 : token_(static_cast<T&&>(completion_token))
0061 {
0062 }
0063
0064
0065
0066 template <typename InnerExecutor>
0067 struct executor_with_default : InnerExecutor
0068 {
0069
0070 typedef as_tuple_t default_completion_token_type;
0071
0072
0073 template <typename InnerExecutor1>
0074 executor_with_default(const InnerExecutor1& ex,
0075 constraint_t<
0076 conditional_t<
0077 !is_same<InnerExecutor1, executor_with_default>::value,
0078 is_convertible<InnerExecutor1, InnerExecutor>,
0079 false_type
0080 >::value
0081 > = 0) noexcept
0082 : InnerExecutor(ex)
0083 {
0084 }
0085 };
0086
0087
0088
0089 template <typename T>
0090 using as_default_on_t = typename T::template rebind_executor<
0091 executor_with_default<typename T::executor_type>>::other;
0092
0093
0094
0095 template <typename T>
0096 static typename decay_t<T>::template rebind_executor<
0097 executor_with_default<typename decay_t<T>::executor_type>
0098 >::other
0099 as_default_on(T&& object)
0100 {
0101 return typename decay_t<T>::template rebind_executor<
0102 executor_with_default<typename decay_t<T>::executor_type>
0103 >::other(static_cast<T&&>(object));
0104 }
0105
0106
0107 CompletionToken token_;
0108 };
0109
0110
0111
0112 template <typename CompletionToken>
0113 BOOST_ASIO_NODISCARD inline
0114 constexpr as_tuple_t<decay_t<CompletionToken>>
0115 as_tuple(CompletionToken&& completion_token)
0116 {
0117 return as_tuple_t<decay_t<CompletionToken>>(
0118 static_cast<CompletionToken&&>(completion_token));
0119 }
0120
0121 }
0122 }
0123
0124 #include <boost/asio/detail/pop_options.hpp>
0125
0126 #include <boost/asio/impl/as_tuple.hpp>
0127
0128 #endif