11 #ifndef ASIO_EXECUTION_CONTEXT_AS_HPP 12 #define ASIO_EXECUTION_CONTEXT_AS_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 #include "asio/detail/config.hpp" 19 #include "asio/detail/type_traits.hpp" 20 #include "asio/execution/context.hpp" 21 #include "asio/execution/executor.hpp" 22 #include "asio/execution/scheduler.hpp" 23 #include "asio/execution/sender.hpp" 24 #include "asio/is_applicable_property.hpp" 25 #include "asio/query.hpp" 26 #include "asio/traits/query_static_constexpr_member.hpp" 27 #include "asio/traits/static_query.hpp" 29 #include "asio/detail/push_options.hpp" 33 #if defined(GENERATING_DOCUMENTATION) 44 static constexpr
bool is_applicable_property_v =
45 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
48 static constexpr
bool is_requirable =
false;
51 static constexpr
bool is_preferable =
false;
54 typedef T polymorphic_query_result_type;
59 constexpr context_as_t context_as;
63 #else // defined(GENERATING_DOCUMENTATION) 70 #if defined(ASIO_HAS_VARIABLE_TEMPLATES) 72 ASIO_STATIC_CONSTEXPR(
bool,
73 is_applicable_property_v = is_executor<U>::value
74 || is_sender<U>::value || is_scheduler<U>::value);
75 #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES) 77 ASIO_STATIC_CONSTEXPR(
bool, is_requirable =
false);
78 ASIO_STATIC_CONSTEXPR(
bool, is_preferable =
false);
80 typedef T polymorphic_query_result_type;
82 ASIO_CONSTEXPR context_as_t()
86 ASIO_CONSTEXPR context_as_t(context_t)
90 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \ 91 && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) 94 typename traits::query_static_constexpr_member<E, context_t>::result_type
97 traits::query_static_constexpr_member<E, context_t>::is_noexcept))
99 return traits::query_static_constexpr_member<E, context_t>::value();
102 template <
typename E,
typename U = decltype(context_as_t::static_query<E>())>
103 static ASIO_CONSTEXPR
const U static_query_v
104 = context_as_t::static_query<E>();
105 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) 108 template <
typename Executor,
typename U>
109 friend ASIO_CONSTEXPR U query(
110 const Executor& ex,
const context_as_t<U>&,
113 && can_query<const Executor&, const context_t&>::value
115 #if !defined(__clang__) // Clang crashes if noexcept is used here. 116 #if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified. 118 is_nothrow_query<const Executor&, const context_t&>::value))
119 #else // defined(ASIO_MSVC) 121 is_nothrow_query<const Executor&, const context_t&>::value))
122 #endif // defined(ASIO_MSVC) 123 #endif // !defined(__clang__) 125 return asio::query(ex, context);
129 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \ 130 && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) 131 template <
typename T>
template <
typename E,
typename U>
132 const U context_as_t<T>::static_query_v;
133 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) 136 #if (defined(ASIO_HAS_VARIABLE_TEMPLATES) \ 137 && defined(ASIO_HAS_CONSTEXPR)) \ 138 || defined(GENERATING_DOCUMENTATION) 139 template <
typename T>
140 constexpr context_as_t<T> context_as{};
141 #endif // (defined(ASIO_HAS_VARIABLE_TEMPLATES) 147 #if !defined(ASIO_HAS_VARIABLE_TEMPLATES) 149 template <
typename T,
typename U>
151 : integral_constant<bool,
152 execution::is_executor<T>::value
153 || execution::is_sender<T>::value
154 || execution::is_scheduler<T>::value>
158 #endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES) 162 #if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \ 163 || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) 165 template <
typename T,
typename U>
168 static_query<T, execution::context_t>::is_valid
173 #endif // !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) 176 #if !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) 178 template <
typename T,
typename U>
181 can_query<const T&, const execution::context_t&>::value
184 ASIO_STATIC_CONSTEXPR(
bool, is_valid =
true);
185 ASIO_STATIC_CONSTEXPR(
bool, is_noexcept =
188 typedef U result_type;
191 #endif // !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) 195 #endif // defined(GENERATING_DOCUMENTATION) 199 #include "asio/detail/pop_options.hpp" 201 #endif // ASIO_EXECUTION_CONTEXT_AS_HPP Definition: query.hpp:269
Definition: static_query.hpp:42
Definition: type_traits.hpp:97
Definition: query_free.hpp:38
Definition: handler_work.hpp:37
Definition: is_applicable_property.hpp:46
Definition: any_io_executor.hpp:28