relationship.hpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. //
  2. // execution/relationship.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2024 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. #ifndef BOOST_ASIO_EXECUTION_RELATIONSHIP_HPP
  11. #define BOOST_ASIO_EXECUTION_RELATIONSHIP_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <boost/asio/detail/type_traits.hpp>
  17. #include <boost/asio/execution/executor.hpp>
  18. #include <boost/asio/is_applicable_property.hpp>
  19. #include <boost/asio/query.hpp>
  20. #include <boost/asio/traits/query_free.hpp>
  21. #include <boost/asio/traits/query_member.hpp>
  22. #include <boost/asio/traits/query_static_constexpr_member.hpp>
  23. #include <boost/asio/traits/static_query.hpp>
  24. #include <boost/asio/traits/static_require.hpp>
  25. #include <boost/asio/detail/push_options.hpp>
  26. namespace boost {
  27. namespace asio {
  28. #if defined(GENERATING_DOCUMENTATION)
  29. namespace execution {
  30. /// A property to describe whether submitted tasks represent continuations of
  31. /// the calling context.
  32. struct relationship_t
  33. {
  34. /// The relationship_t property applies to executors.
  35. template <typename T>
  36. static constexpr bool is_applicable_property_v = is_executor_v<T>;
  37. /// The top-level relationship_t property cannot be required.
  38. static constexpr bool is_requirable = false;
  39. /// The top-level relationship_t property cannot be preferred.
  40. static constexpr bool is_preferable = false;
  41. /// The type returned by queries against an @c any_executor.
  42. typedef relationship_t polymorphic_query_result_type;
  43. /// A sub-property that indicates that the executor does not represent a
  44. /// continuation of the calling context.
  45. struct fork_t
  46. {
  47. /// The relationship_t::fork_t property applies to executors.
  48. template <typename T>
  49. static constexpr bool is_applicable_property_v = is_executor_v<T>;
  50. /// The relationship_t::fork_t property can be required.
  51. static constexpr bool is_requirable = true;
  52. /// The relationship_t::fork_t property can be preferred.
  53. static constexpr bool is_preferable = true;
  54. /// The type returned by queries against an @c any_executor.
  55. typedef relationship_t polymorphic_query_result_type;
  56. /// Default constructor.
  57. constexpr fork_t();
  58. /// Get the value associated with a property object.
  59. /**
  60. * @returns fork_t();
  61. */
  62. static constexpr relationship_t value();
  63. };
  64. /// A sub-property that indicates that the executor represents a continuation
  65. /// of the calling context.
  66. struct continuation_t
  67. {
  68. /// The relationship_t::continuation_t property applies to executors.
  69. template <typename T>
  70. static constexpr bool is_applicable_property_v = is_executor_v<T>;
  71. /// The relationship_t::continuation_t property can be required.
  72. static constexpr bool is_requirable = true;
  73. /// The relationship_t::continuation_t property can be preferred.
  74. static constexpr bool is_preferable = true;
  75. /// The type returned by queries against an @c any_executor.
  76. typedef relationship_t polymorphic_query_result_type;
  77. /// Default constructor.
  78. constexpr continuation_t();
  79. /// Get the value associated with a property object.
  80. /**
  81. * @returns continuation_t();
  82. */
  83. static constexpr relationship_t value();
  84. };
  85. /// A special value used for accessing the relationship_t::fork_t property.
  86. static constexpr fork_t fork;
  87. /// A special value used for accessing the relationship_t::continuation_t
  88. /// property.
  89. static constexpr continuation_t continuation;
  90. /// Default constructor.
  91. constexpr relationship_t();
  92. /// Construct from a sub-property value.
  93. constexpr relationship_t(fork_t);
  94. /// Construct from a sub-property value.
  95. constexpr relationship_t(continuation_t);
  96. /// Compare property values for equality.
  97. friend constexpr bool operator==(
  98. const relationship_t& a, const relationship_t& b) noexcept;
  99. /// Compare property values for inequality.
  100. friend constexpr bool operator!=(
  101. const relationship_t& a, const relationship_t& b) noexcept;
  102. };
  103. /// A special value used for accessing the relationship_t property.
  104. constexpr relationship_t relationship;
  105. } // namespace execution
  106. #else // defined(GENERATING_DOCUMENTATION)
  107. namespace execution {
  108. namespace detail {
  109. namespace relationship {
  110. template <int I> struct fork_t;
  111. template <int I> struct continuation_t;
  112. } // namespace relationship
  113. template <int I = 0>
  114. struct relationship_t
  115. {
  116. #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  117. template <typename T>
  118. static constexpr bool is_applicable_property_v = is_executor<T>::value;
  119. #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  120. static constexpr bool is_requirable = false;
  121. static constexpr bool is_preferable = false;
  122. typedef relationship_t polymorphic_query_result_type;
  123. typedef detail::relationship::fork_t<I> fork_t;
  124. typedef detail::relationship::continuation_t<I> continuation_t;
  125. constexpr relationship_t()
  126. : value_(-1)
  127. {
  128. }
  129. constexpr relationship_t(fork_t)
  130. : value_(0)
  131. {
  132. }
  133. constexpr relationship_t(continuation_t)
  134. : value_(1)
  135. {
  136. }
  137. template <typename T>
  138. struct proxy
  139. {
  140. #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  141. struct type
  142. {
  143. template <typename P>
  144. auto query(P&& p) const
  145. noexcept(
  146. noexcept(
  147. declval<conditional_t<true, T, P>>().query(static_cast<P&&>(p))
  148. )
  149. )
  150. -> decltype(
  151. declval<conditional_t<true, T, P>>().query(static_cast<P&&>(p))
  152. );
  153. };
  154. #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  155. typedef T type;
  156. #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  157. };
  158. template <typename T>
  159. struct static_proxy
  160. {
  161. #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  162. struct type
  163. {
  164. template <typename P>
  165. static constexpr auto query(P&& p)
  166. noexcept(
  167. noexcept(
  168. conditional_t<true, T, P>::query(static_cast<P&&>(p))
  169. )
  170. )
  171. -> decltype(
  172. conditional_t<true, T, P>::query(static_cast<P&&>(p))
  173. )
  174. {
  175. return T::query(static_cast<P&&>(p));
  176. }
  177. };
  178. #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  179. typedef T type;
  180. #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  181. };
  182. template <typename T>
  183. struct query_member :
  184. traits::query_member<typename proxy<T>::type, relationship_t> {};
  185. template <typename T>
  186. struct query_static_constexpr_member :
  187. traits::query_static_constexpr_member<
  188. typename static_proxy<T>::type, relationship_t> {};
  189. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  190. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  191. template <typename T>
  192. static constexpr
  193. typename query_static_constexpr_member<T>::result_type
  194. static_query()
  195. noexcept(query_static_constexpr_member<T>::is_noexcept)
  196. {
  197. return query_static_constexpr_member<T>::value();
  198. }
  199. template <typename T>
  200. static constexpr
  201. typename traits::static_query<T, fork_t>::result_type
  202. static_query(
  203. enable_if_t<
  204. !query_static_constexpr_member<T>::is_valid
  205. >* = 0,
  206. enable_if_t<
  207. !query_member<T>::is_valid
  208. >* = 0,
  209. enable_if_t<
  210. traits::static_query<T, fork_t>::is_valid
  211. >* = 0) noexcept
  212. {
  213. return traits::static_query<T, fork_t>::value();
  214. }
  215. template <typename T>
  216. static constexpr
  217. typename traits::static_query<T, continuation_t>::result_type
  218. static_query(
  219. enable_if_t<
  220. !query_static_constexpr_member<T>::is_valid
  221. >* = 0,
  222. enable_if_t<
  223. !query_member<T>::is_valid
  224. >* = 0,
  225. enable_if_t<
  226. !traits::static_query<T, fork_t>::is_valid
  227. >* = 0,
  228. enable_if_t<
  229. traits::static_query<T, continuation_t>::is_valid
  230. >* = 0) noexcept
  231. {
  232. return traits::static_query<T, continuation_t>::value();
  233. }
  234. template <typename E,
  235. typename T = decltype(relationship_t::static_query<E>())>
  236. static constexpr const T static_query_v
  237. = relationship_t::static_query<E>();
  238. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  239. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  240. friend constexpr bool operator==(
  241. const relationship_t& a, const relationship_t& b)
  242. {
  243. return a.value_ == b.value_;
  244. }
  245. friend constexpr bool operator!=(
  246. const relationship_t& a, const relationship_t& b)
  247. {
  248. return a.value_ != b.value_;
  249. }
  250. struct convertible_from_relationship_t
  251. {
  252. constexpr convertible_from_relationship_t(relationship_t)
  253. {
  254. }
  255. };
  256. template <typename Executor>
  257. friend constexpr relationship_t query(
  258. const Executor& ex, convertible_from_relationship_t,
  259. enable_if_t<
  260. can_query<const Executor&, fork_t>::value
  261. >* = 0)
  262. #if !defined(__clang__) // Clang crashes if noexcept is used here.
  263. #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
  264. noexcept(is_nothrow_query<const Executor&, relationship_t<>::fork_t>::value)
  265. #else // defined(BOOST_ASIO_MSVC)
  266. noexcept(is_nothrow_query<const Executor&, fork_t>::value)
  267. #endif // defined(BOOST_ASIO_MSVC)
  268. #endif // !defined(__clang__)
  269. {
  270. return boost::asio::query(ex, fork_t());
  271. }
  272. template <typename Executor>
  273. friend constexpr relationship_t query(
  274. const Executor& ex, convertible_from_relationship_t,
  275. enable_if_t<
  276. !can_query<const Executor&, fork_t>::value
  277. >* = 0,
  278. enable_if_t<
  279. can_query<const Executor&, continuation_t>::value
  280. >* = 0)
  281. #if !defined(__clang__) // Clang crashes if noexcept is used here.
  282. #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
  283. noexcept(is_nothrow_query<const Executor&,
  284. relationship_t<>::continuation_t>::value)
  285. #else // defined(BOOST_ASIO_MSVC)
  286. noexcept(is_nothrow_query<const Executor&, continuation_t>::value)
  287. #endif // defined(BOOST_ASIO_MSVC)
  288. #endif // !defined(__clang__)
  289. {
  290. return boost::asio::query(ex, continuation_t());
  291. }
  292. BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(fork_t, fork);
  293. BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(continuation_t, continuation);
  294. private:
  295. int value_;
  296. };
  297. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  298. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  299. template <int I> template <typename E, typename T>
  300. const T relationship_t<I>::static_query_v;
  301. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  302. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  303. template <int I>
  304. const typename relationship_t<I>::fork_t relationship_t<I>::fork;
  305. template <int I>
  306. const typename relationship_t<I>::continuation_t
  307. relationship_t<I>::continuation;
  308. namespace relationship {
  309. template <int I = 0>
  310. struct fork_t
  311. {
  312. #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  313. template <typename T>
  314. static constexpr bool is_applicable_property_v = is_executor<T>::value;
  315. #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  316. static constexpr bool is_requirable = true;
  317. static constexpr bool is_preferable = true;
  318. typedef relationship_t<I> polymorphic_query_result_type;
  319. constexpr fork_t()
  320. {
  321. }
  322. template <typename T>
  323. struct query_member :
  324. traits::query_member<
  325. typename relationship_t<I>::template proxy<T>::type, fork_t> {};
  326. template <typename T>
  327. struct query_static_constexpr_member :
  328. traits::query_static_constexpr_member<
  329. typename relationship_t<I>::template static_proxy<T>::type, fork_t> {};
  330. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  331. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  332. template <typename T>
  333. static constexpr typename query_static_constexpr_member<T>::result_type
  334. static_query()
  335. noexcept(query_static_constexpr_member<T>::is_noexcept)
  336. {
  337. return query_static_constexpr_member<T>::value();
  338. }
  339. template <typename T>
  340. static constexpr fork_t static_query(
  341. enable_if_t<
  342. !query_static_constexpr_member<T>::is_valid
  343. >* = 0,
  344. enable_if_t<
  345. !query_member<T>::is_valid
  346. >* = 0,
  347. enable_if_t<
  348. !traits::query_free<T, fork_t>::is_valid
  349. >* = 0,
  350. enable_if_t<
  351. !can_query<T, continuation_t<I>>::value
  352. >* = 0) noexcept
  353. {
  354. return fork_t();
  355. }
  356. template <typename E, typename T = decltype(fork_t::static_query<E>())>
  357. static constexpr const T static_query_v
  358. = fork_t::static_query<E>();
  359. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  360. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  361. static constexpr relationship_t<I> value()
  362. {
  363. return fork_t();
  364. }
  365. friend constexpr bool operator==(const fork_t&, const fork_t&)
  366. {
  367. return true;
  368. }
  369. friend constexpr bool operator!=(const fork_t&, const fork_t&)
  370. {
  371. return false;
  372. }
  373. friend constexpr bool operator==(const fork_t&, const continuation_t<I>&)
  374. {
  375. return false;
  376. }
  377. friend constexpr bool operator!=(const fork_t&, const continuation_t<I>&)
  378. {
  379. return true;
  380. }
  381. };
  382. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  383. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  384. template <int I> template <typename E, typename T>
  385. const T fork_t<I>::static_query_v;
  386. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  387. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  388. template <int I = 0>
  389. struct continuation_t
  390. {
  391. #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  392. template <typename T>
  393. static constexpr bool is_applicable_property_v = is_executor<T>::value;
  394. #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  395. static constexpr bool is_requirable = true;
  396. static constexpr bool is_preferable = true;
  397. typedef relationship_t<I> polymorphic_query_result_type;
  398. constexpr continuation_t()
  399. {
  400. }
  401. template <typename T>
  402. struct query_member :
  403. traits::query_member<
  404. typename relationship_t<I>::template proxy<T>::type, continuation_t> {};
  405. template <typename T>
  406. struct query_static_constexpr_member :
  407. traits::query_static_constexpr_member<
  408. typename relationship_t<I>::template static_proxy<T>::type,
  409. continuation_t> {};
  410. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  411. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  412. template <typename T>
  413. static constexpr typename query_static_constexpr_member<T>::result_type
  414. static_query()
  415. noexcept(query_static_constexpr_member<T>::is_noexcept)
  416. {
  417. return query_static_constexpr_member<T>::value();
  418. }
  419. template <typename E,
  420. typename T = decltype(continuation_t::static_query<E>())>
  421. static constexpr const T static_query_v
  422. = continuation_t::static_query<E>();
  423. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  424. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  425. static constexpr relationship_t<I> value()
  426. {
  427. return continuation_t();
  428. }
  429. friend constexpr bool operator==(const continuation_t&, const continuation_t&)
  430. {
  431. return true;
  432. }
  433. friend constexpr bool operator!=(const continuation_t&, const continuation_t&)
  434. {
  435. return false;
  436. }
  437. friend constexpr bool operator==(const continuation_t&, const fork_t<I>&)
  438. {
  439. return false;
  440. }
  441. friend constexpr bool operator!=(const continuation_t&, const fork_t<I>&)
  442. {
  443. return true;
  444. }
  445. };
  446. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  447. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  448. template <int I> template <typename E, typename T>
  449. const T continuation_t<I>::static_query_v;
  450. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  451. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  452. } // namespace relationship
  453. } // namespace detail
  454. typedef detail::relationship_t<> relationship_t;
  455. BOOST_ASIO_INLINE_VARIABLE constexpr relationship_t relationship;
  456. } // namespace execution
  457. #if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  458. template <typename T>
  459. struct is_applicable_property<T, execution::relationship_t>
  460. : integral_constant<bool, execution::is_executor<T>::value>
  461. {
  462. };
  463. template <typename T>
  464. struct is_applicable_property<T, execution::relationship_t::fork_t>
  465. : integral_constant<bool, execution::is_executor<T>::value>
  466. {
  467. };
  468. template <typename T>
  469. struct is_applicable_property<T, execution::relationship_t::continuation_t>
  470. : integral_constant<bool, execution::is_executor<T>::value>
  471. {
  472. };
  473. #endif // !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  474. namespace traits {
  475. #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
  476. template <typename T>
  477. struct query_free_default<T, execution::relationship_t,
  478. enable_if_t<
  479. can_query<T, execution::relationship_t::fork_t>::value
  480. >>
  481. {
  482. static constexpr bool is_valid = true;
  483. static constexpr bool is_noexcept =
  484. is_nothrow_query<T, execution::relationship_t::fork_t>::value;
  485. typedef execution::relationship_t result_type;
  486. };
  487. template <typename T>
  488. struct query_free_default<T, execution::relationship_t,
  489. enable_if_t<
  490. !can_query<T, execution::relationship_t::fork_t>::value
  491. && can_query<T, execution::relationship_t::continuation_t>::value
  492. >>
  493. {
  494. static constexpr bool is_valid = true;
  495. static constexpr bool is_noexcept =
  496. is_nothrow_query<T, execution::relationship_t::continuation_t>::value;
  497. typedef execution::relationship_t result_type;
  498. };
  499. #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
  500. #if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  501. || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  502. template <typename T>
  503. struct static_query<T, execution::relationship_t,
  504. enable_if_t<
  505. execution::detail::relationship_t<0>::
  506. query_static_constexpr_member<T>::is_valid
  507. >>
  508. {
  509. static constexpr bool is_valid = true;
  510. static constexpr bool is_noexcept = true;
  511. typedef typename execution::detail::relationship_t<0>::
  512. query_static_constexpr_member<T>::result_type result_type;
  513. static constexpr result_type value()
  514. {
  515. return execution::detail::relationship_t<0>::
  516. query_static_constexpr_member<T>::value();
  517. }
  518. };
  519. template <typename T>
  520. struct static_query<T, execution::relationship_t,
  521. enable_if_t<
  522. !execution::detail::relationship_t<0>::
  523. query_static_constexpr_member<T>::is_valid
  524. && !execution::detail::relationship_t<0>::
  525. query_member<T>::is_valid
  526. && traits::static_query<T,
  527. execution::relationship_t::fork_t>::is_valid
  528. >>
  529. {
  530. static constexpr bool is_valid = true;
  531. static constexpr bool is_noexcept = true;
  532. typedef typename traits::static_query<T,
  533. execution::relationship_t::fork_t>::result_type result_type;
  534. static constexpr result_type value()
  535. {
  536. return traits::static_query<T,
  537. execution::relationship_t::fork_t>::value();
  538. }
  539. };
  540. template <typename T>
  541. struct static_query<T, execution::relationship_t,
  542. enable_if_t<
  543. !execution::detail::relationship_t<0>::
  544. query_static_constexpr_member<T>::is_valid
  545. && !execution::detail::relationship_t<0>::
  546. query_member<T>::is_valid
  547. && !traits::static_query<T,
  548. execution::relationship_t::fork_t>::is_valid
  549. && traits::static_query<T,
  550. execution::relationship_t::continuation_t>::is_valid
  551. >>
  552. {
  553. static constexpr bool is_valid = true;
  554. static constexpr bool is_noexcept = true;
  555. typedef typename traits::static_query<T,
  556. execution::relationship_t::continuation_t>::result_type result_type;
  557. static constexpr result_type value()
  558. {
  559. return traits::static_query<T,
  560. execution::relationship_t::continuation_t>::value();
  561. }
  562. };
  563. template <typename T>
  564. struct static_query<T, execution::relationship_t::fork_t,
  565. enable_if_t<
  566. execution::detail::relationship::fork_t<0>::
  567. query_static_constexpr_member<T>::is_valid
  568. >>
  569. {
  570. static constexpr bool is_valid = true;
  571. static constexpr bool is_noexcept = true;
  572. typedef typename execution::detail::relationship::fork_t<0>::
  573. query_static_constexpr_member<T>::result_type result_type;
  574. static constexpr result_type value()
  575. {
  576. return execution::detail::relationship::fork_t<0>::
  577. query_static_constexpr_member<T>::value();
  578. }
  579. };
  580. template <typename T>
  581. struct static_query<T, execution::relationship_t::fork_t,
  582. enable_if_t<
  583. !execution::detail::relationship::fork_t<0>::
  584. query_static_constexpr_member<T>::is_valid
  585. && !execution::detail::relationship::fork_t<0>::
  586. query_member<T>::is_valid
  587. && !traits::query_free<T,
  588. execution::relationship_t::fork_t>::is_valid
  589. && !can_query<T, execution::relationship_t::continuation_t>::value
  590. >>
  591. {
  592. static constexpr bool is_valid = true;
  593. static constexpr bool is_noexcept = true;
  594. typedef execution::relationship_t::fork_t result_type;
  595. static constexpr result_type value()
  596. {
  597. return result_type();
  598. }
  599. };
  600. template <typename T>
  601. struct static_query<T, execution::relationship_t::continuation_t,
  602. enable_if_t<
  603. execution::detail::relationship::continuation_t<0>::
  604. query_static_constexpr_member<T>::is_valid
  605. >>
  606. {
  607. static constexpr bool is_valid = true;
  608. static constexpr bool is_noexcept = true;
  609. typedef typename execution::detail::relationship::continuation_t<0>::
  610. query_static_constexpr_member<T>::result_type result_type;
  611. static constexpr result_type value()
  612. {
  613. return execution::detail::relationship::continuation_t<0>::
  614. query_static_constexpr_member<T>::value();
  615. }
  616. };
  617. #endif // !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  618. // || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  619. } // namespace traits
  620. #endif // defined(GENERATING_DOCUMENTATION)
  621. } // namespace asio
  622. } // namespace boost
  623. #include <boost/asio/detail/pop_options.hpp>
  624. #endif // BOOST_ASIO_EXECUTION_RELATIONSHIP_HPP