bulk_guarantee.hpp 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254
  1. //
  2. // execution/bulk_guarantee.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2023 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_BULK_GUARANTEE_HPP
  11. #define BOOST_ASIO_EXECUTION_BULK_GUARANTEE_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. #if !defined(BOOST_ASIO_NO_DEPRECATED)
  17. #include <boost/asio/detail/type_traits.hpp>
  18. #include <boost/asio/execution/executor.hpp>
  19. #include <boost/asio/execution/scheduler.hpp>
  20. #include <boost/asio/execution/sender.hpp>
  21. #include <boost/asio/is_applicable_property.hpp>
  22. #include <boost/asio/query.hpp>
  23. #include <boost/asio/traits/query_free.hpp>
  24. #include <boost/asio/traits/query_member.hpp>
  25. #include <boost/asio/traits/query_static_constexpr_member.hpp>
  26. #include <boost/asio/traits/static_query.hpp>
  27. #include <boost/asio/traits/static_require.hpp>
  28. #include <boost/asio/detail/push_options.hpp>
  29. namespace boost {
  30. namespace asio {
  31. #if defined(GENERATING_DOCUMENTATION)
  32. namespace execution {
  33. /// A property to communicate the forward progress and ordering guarantees of
  34. /// execution agents associated with the bulk execution.
  35. struct bulk_guarantee_t
  36. {
  37. /// The bulk_guarantee_t property applies to executors, senders, and
  38. /// schedulers.
  39. template <typename T>
  40. static constexpr bool is_applicable_property_v =
  41. is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
  42. /// The top-level bulk_guarantee_t property cannot be required.
  43. static constexpr bool is_requirable = false;
  44. /// The top-level bulk_guarantee_t property cannot be preferred.
  45. static constexpr bool is_preferable = false;
  46. /// The type returned by queries against an @c any_executor.
  47. typedef bulk_guarantee_t polymorphic_query_result_type;
  48. /// A sub-property that indicates that execution agents within the same bulk
  49. /// execution may be parallelised and vectorised.
  50. struct unsequenced_t
  51. {
  52. /// The bulk_guarantee_t::unsequenced_t property applies to executors,
  53. /// senders, and schedulers.
  54. template <typename T>
  55. static constexpr bool is_applicable_property_v =
  56. is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
  57. /// The bulk_guarantee_t::unsequenced_t property can be required.
  58. static constexpr bool is_requirable = true;
  59. /// The bulk_guarantee_t::unsequenced_t property can be preferred.
  60. static constexpr bool is_preferable = true;
  61. /// The type returned by queries against an @c any_executor.
  62. typedef bulk_guarantee_t polymorphic_query_result_type;
  63. /// Default constructor.
  64. constexpr unsequenced_t();
  65. /// Get the value associated with a property object.
  66. /**
  67. * @returns unsequenced_t();
  68. */
  69. static constexpr bulk_guarantee_t value();
  70. };
  71. /// A sub-property that indicates that execution agents within the same bulk
  72. /// execution may not be parallelised and vectorised.
  73. struct sequenced_t
  74. {
  75. /// The bulk_guarantee_t::sequenced_t property applies to executors,
  76. /// senders, and schedulers.
  77. template <typename T>
  78. static constexpr bool is_applicable_property_v =
  79. is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
  80. /// The bulk_guarantee_t::sequenced_t property can be required.
  81. static constexpr bool is_requirable = true;
  82. /// The bulk_guarantee_t::sequenced_t property can be preferred.
  83. static constexpr bool is_preferable = true;
  84. /// The type returned by queries against an @c any_executor.
  85. typedef bulk_guarantee_t polymorphic_query_result_type;
  86. /// Default constructor.
  87. constexpr sequenced_t();
  88. /// Get the value associated with a property object.
  89. /**
  90. * @returns sequenced_t();
  91. */
  92. static constexpr bulk_guarantee_t value();
  93. };
  94. /// A sub-property that indicates that execution agents within the same bulk
  95. /// execution may be parallelised.
  96. struct parallel_t
  97. {
  98. /// The bulk_guarantee_t::parallel_t property applies to executors,
  99. /// senders, and schedulers.
  100. template <typename T>
  101. static constexpr bool is_applicable_property_v =
  102. is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
  103. /// The bulk_guarantee_t::parallel_t property can be required.
  104. static constexpr bool is_requirable = true;
  105. /// The bulk_guarantee_t::parallel_t property can be preferred.
  106. static constexpr bool is_preferable = true;
  107. /// The type returned by queries against an @c any_executor.
  108. typedef bulk_guarantee_t polymorphic_query_result_type;
  109. /// Default constructor.
  110. constexpr parallel_t();
  111. /// Get the value associated with a property object.
  112. /**
  113. * @returns parallel_t();
  114. */
  115. static constexpr bulk_guarantee_t value();
  116. };
  117. /// A special value used for accessing the bulk_guarantee_t::unsequenced_t
  118. /// property.
  119. static constexpr unsequenced_t unsequenced;
  120. /// A special value used for accessing the bulk_guarantee_t::sequenced_t
  121. /// property.
  122. static constexpr sequenced_t sequenced;
  123. /// A special value used for accessing the bulk_guarantee_t::parallel_t
  124. /// property.
  125. static constexpr parallel_t parallel;
  126. /// Default constructor.
  127. constexpr bulk_guarantee_t();
  128. /// Construct from a sub-property value.
  129. constexpr bulk_guarantee_t(unsequenced_t);
  130. /// Construct from a sub-property value.
  131. constexpr bulk_guarantee_t(sequenced_t);
  132. /// Construct from a sub-property value.
  133. constexpr bulk_guarantee_t(parallel_t);
  134. /// Compare property values for equality.
  135. friend constexpr bool operator==(
  136. const bulk_guarantee_t& a, const bulk_guarantee_t& b) noexcept;
  137. /// Compare property values for inequality.
  138. friend constexpr bool operator!=(
  139. const bulk_guarantee_t& a, const bulk_guarantee_t& b) noexcept;
  140. };
  141. /// A special value used for accessing the bulk_guarantee_t property.
  142. constexpr bulk_guarantee_t bulk_guarantee;
  143. } // namespace execution
  144. #else // defined(GENERATING_DOCUMENTATION)
  145. namespace execution {
  146. namespace detail {
  147. namespace bulk_guarantee {
  148. template <int I> struct unsequenced_t;
  149. template <int I> struct sequenced_t;
  150. template <int I> struct parallel_t;
  151. } // namespace bulk_guarantee
  152. template <int I = 0>
  153. struct bulk_guarantee_t
  154. {
  155. #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  156. # if defined(BOOST_ASIO_NO_DEPRECATED)
  157. template <typename T>
  158. BOOST_ASIO_STATIC_CONSTEXPR(bool,
  159. is_applicable_property_v = (
  160. is_executor<T>::value));
  161. # else // defined(BOOST_ASIO_NO_DEPRECATED)
  162. template <typename T>
  163. BOOST_ASIO_STATIC_CONSTEXPR(bool,
  164. is_applicable_property_v = (
  165. is_executor<T>::value
  166. || conditional<
  167. is_executor<T>::value,
  168. false_type,
  169. is_sender<T>
  170. >::type::value
  171. || conditional<
  172. is_executor<T>::value,
  173. false_type,
  174. is_scheduler<T>
  175. >::type::value
  176. ));
  177. # endif // defined(BOOST_ASIO_NO_DEPRECATED)
  178. #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  179. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
  180. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
  181. typedef bulk_guarantee_t polymorphic_query_result_type;
  182. typedef detail::bulk_guarantee::unsequenced_t<I> unsequenced_t;
  183. typedef detail::bulk_guarantee::sequenced_t<I> sequenced_t;
  184. typedef detail::bulk_guarantee::parallel_t<I> parallel_t;
  185. BOOST_ASIO_CONSTEXPR bulk_guarantee_t()
  186. : value_(-1)
  187. {
  188. }
  189. BOOST_ASIO_CONSTEXPR bulk_guarantee_t(unsequenced_t)
  190. : value_(0)
  191. {
  192. }
  193. BOOST_ASIO_CONSTEXPR bulk_guarantee_t(sequenced_t)
  194. : value_(1)
  195. {
  196. }
  197. BOOST_ASIO_CONSTEXPR bulk_guarantee_t(parallel_t)
  198. : value_(2)
  199. {
  200. }
  201. template <typename T>
  202. struct proxy
  203. {
  204. #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  205. struct type
  206. {
  207. template <typename P>
  208. auto query(BOOST_ASIO_MOVE_ARG(P) p) const
  209. noexcept(
  210. noexcept(
  211. declval<typename conditional<true, T, P>::type>().query(
  212. BOOST_ASIO_MOVE_CAST(P)(p))
  213. )
  214. )
  215. -> decltype(
  216. declval<typename conditional<true, T, P>::type>().query(
  217. BOOST_ASIO_MOVE_CAST(P)(p))
  218. );
  219. };
  220. #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  221. typedef T type;
  222. #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  223. };
  224. template <typename T>
  225. struct static_proxy
  226. {
  227. #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  228. struct type
  229. {
  230. template <typename P>
  231. static constexpr auto query(BOOST_ASIO_MOVE_ARG(P) p)
  232. noexcept(
  233. noexcept(
  234. conditional<true, T, P>::type::query(BOOST_ASIO_MOVE_CAST(P)(p))
  235. )
  236. )
  237. -> decltype(
  238. conditional<true, T, P>::type::query(BOOST_ASIO_MOVE_CAST(P)(p))
  239. )
  240. {
  241. return T::query(BOOST_ASIO_MOVE_CAST(P)(p));
  242. }
  243. };
  244. #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  245. typedef T type;
  246. #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  247. };
  248. template <typename T>
  249. struct query_member :
  250. traits::query_member<typename proxy<T>::type, bulk_guarantee_t> {};
  251. template <typename T>
  252. struct query_static_constexpr_member :
  253. traits::query_static_constexpr_member<
  254. typename static_proxy<T>::type, bulk_guarantee_t> {};
  255. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  256. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  257. template <typename T>
  258. static BOOST_ASIO_CONSTEXPR
  259. typename query_static_constexpr_member<T>::result_type
  260. static_query()
  261. BOOST_ASIO_NOEXCEPT_IF((
  262. query_static_constexpr_member<T>::is_noexcept))
  263. {
  264. return query_static_constexpr_member<T>::value();
  265. }
  266. template <typename T>
  267. static BOOST_ASIO_CONSTEXPR
  268. typename traits::static_query<T, unsequenced_t>::result_type
  269. static_query(
  270. typename enable_if<
  271. !query_static_constexpr_member<T>::is_valid
  272. >::type* = 0,
  273. typename enable_if<
  274. !query_member<T>::is_valid
  275. >::type* = 0,
  276. typename enable_if<
  277. traits::static_query<T, unsequenced_t>::is_valid
  278. >::type* = 0) BOOST_ASIO_NOEXCEPT
  279. {
  280. return traits::static_query<T, unsequenced_t>::value();
  281. }
  282. template <typename T>
  283. static BOOST_ASIO_CONSTEXPR
  284. typename traits::static_query<T, sequenced_t>::result_type
  285. static_query(
  286. typename enable_if<
  287. !query_static_constexpr_member<T>::is_valid
  288. >::type* = 0,
  289. typename enable_if<
  290. !query_member<T>::is_valid
  291. >::type* = 0,
  292. typename enable_if<
  293. !traits::static_query<T, unsequenced_t>::is_valid
  294. >::type* = 0,
  295. typename enable_if<
  296. traits::static_query<T, sequenced_t>::is_valid
  297. >::type* = 0) BOOST_ASIO_NOEXCEPT
  298. {
  299. return traits::static_query<T, sequenced_t>::value();
  300. }
  301. template <typename T>
  302. static BOOST_ASIO_CONSTEXPR
  303. typename traits::static_query<T, parallel_t>::result_type
  304. static_query(
  305. typename enable_if<
  306. !query_static_constexpr_member<T>::is_valid
  307. >::type* = 0,
  308. typename enable_if<
  309. !query_member<T>::is_valid
  310. >::type* = 0,
  311. typename enable_if<
  312. !traits::static_query<T, unsequenced_t>::is_valid
  313. >::type* = 0,
  314. typename enable_if<
  315. !traits::static_query<T, sequenced_t>::is_valid
  316. >::type* = 0,
  317. typename enable_if<
  318. traits::static_query<T, parallel_t>::is_valid
  319. >::type* = 0) BOOST_ASIO_NOEXCEPT
  320. {
  321. return traits::static_query<T, parallel_t>::value();
  322. }
  323. template <typename E,
  324. typename T = decltype(bulk_guarantee_t::static_query<E>())>
  325. static BOOST_ASIO_CONSTEXPR const T static_query_v
  326. = bulk_guarantee_t::static_query<E>();
  327. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  328. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  329. friend BOOST_ASIO_CONSTEXPR bool operator==(
  330. const bulk_guarantee_t& a, const bulk_guarantee_t& b)
  331. {
  332. return a.value_ == b.value_;
  333. }
  334. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  335. const bulk_guarantee_t& a, const bulk_guarantee_t& b)
  336. {
  337. return a.value_ != b.value_;
  338. }
  339. struct convertible_from_bulk_guarantee_t
  340. {
  341. BOOST_ASIO_CONSTEXPR convertible_from_bulk_guarantee_t(bulk_guarantee_t) {}
  342. };
  343. template <typename Executor>
  344. friend BOOST_ASIO_CONSTEXPR bulk_guarantee_t query(
  345. const Executor& ex, convertible_from_bulk_guarantee_t,
  346. typename enable_if<
  347. can_query<const Executor&, unsequenced_t>::value
  348. >::type* = 0)
  349. #if !defined(__clang__) // Clang crashes if noexcept is used here.
  350. #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
  351. BOOST_ASIO_NOEXCEPT_IF((
  352. is_nothrow_query<const Executor&,
  353. bulk_guarantee_t<>::unsequenced_t>::value))
  354. #else // defined(BOOST_ASIO_MSVC)
  355. BOOST_ASIO_NOEXCEPT_IF((
  356. is_nothrow_query<const Executor&, unsequenced_t>::value))
  357. #endif // defined(BOOST_ASIO_MSVC)
  358. #endif // !defined(__clang__)
  359. {
  360. return boost::asio::query(ex, unsequenced_t());
  361. }
  362. template <typename Executor>
  363. friend BOOST_ASIO_CONSTEXPR bulk_guarantee_t query(
  364. const Executor& ex, convertible_from_bulk_guarantee_t,
  365. typename enable_if<
  366. !can_query<const Executor&, unsequenced_t>::value
  367. >::type* = 0,
  368. typename enable_if<
  369. can_query<const Executor&, sequenced_t>::value
  370. >::type* = 0)
  371. #if !defined(__clang__) // Clang crashes if noexcept is used here.
  372. #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
  373. BOOST_ASIO_NOEXCEPT_IF((
  374. is_nothrow_query<const Executor&,
  375. bulk_guarantee_t<>::sequenced_t>::value))
  376. #else // defined(BOOST_ASIO_MSVC)
  377. BOOST_ASIO_NOEXCEPT_IF((
  378. is_nothrow_query<const Executor&, sequenced_t>::value))
  379. #endif // defined(BOOST_ASIO_MSVC)
  380. #endif // !defined(__clang__)
  381. {
  382. return boost::asio::query(ex, sequenced_t());
  383. }
  384. template <typename Executor>
  385. friend BOOST_ASIO_CONSTEXPR bulk_guarantee_t query(
  386. const Executor& ex, convertible_from_bulk_guarantee_t,
  387. typename enable_if<
  388. !can_query<const Executor&, unsequenced_t>::value
  389. >::type* = 0,
  390. typename enable_if<
  391. !can_query<const Executor&, sequenced_t>::value
  392. >::type* = 0,
  393. typename enable_if<
  394. can_query<const Executor&, parallel_t>::value
  395. >::type* = 0)
  396. #if !defined(__clang__) // Clang crashes if noexcept is used here.
  397. #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
  398. BOOST_ASIO_NOEXCEPT_IF((
  399. is_nothrow_query<const Executor&, bulk_guarantee_t<>::parallel_t>::value))
  400. #else // defined(BOOST_ASIO_MSVC)
  401. BOOST_ASIO_NOEXCEPT_IF((
  402. is_nothrow_query<const Executor&, parallel_t>::value))
  403. #endif // defined(BOOST_ASIO_MSVC)
  404. #endif // !defined(__clang__)
  405. {
  406. return boost::asio::query(ex, parallel_t());
  407. }
  408. BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(unsequenced_t, unsequenced);
  409. BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(sequenced_t, sequenced);
  410. BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(parallel_t, parallel);
  411. #if !defined(BOOST_ASIO_HAS_CONSTEXPR)
  412. static const bulk_guarantee_t instance;
  413. #endif // !defined(BOOST_ASIO_HAS_CONSTEXPR)
  414. private:
  415. int value_;
  416. };
  417. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  418. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  419. template <int I> template <typename E, typename T>
  420. const T bulk_guarantee_t<I>::static_query_v;
  421. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  422. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  423. #if !defined(BOOST_ASIO_HAS_CONSTEXPR)
  424. template <int I>
  425. const bulk_guarantee_t<I> bulk_guarantee_t<I>::instance;
  426. #endif
  427. template <int I>
  428. const typename bulk_guarantee_t<I>::unsequenced_t
  429. bulk_guarantee_t<I>::unsequenced;
  430. template <int I>
  431. const typename bulk_guarantee_t<I>::sequenced_t
  432. bulk_guarantee_t<I>::sequenced;
  433. template <int I>
  434. const typename bulk_guarantee_t<I>::parallel_t
  435. bulk_guarantee_t<I>::parallel;
  436. namespace bulk_guarantee {
  437. template <int I = 0>
  438. struct unsequenced_t
  439. {
  440. #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  441. # if defined(BOOST_ASIO_NO_DEPRECATED)
  442. template <typename T>
  443. BOOST_ASIO_STATIC_CONSTEXPR(bool,
  444. is_applicable_property_v = (
  445. is_executor<T>::value));
  446. # else // defined(BOOST_ASIO_NO_DEPRECATED)
  447. template <typename T>
  448. BOOST_ASIO_STATIC_CONSTEXPR(bool,
  449. is_applicable_property_v = (
  450. is_executor<T>::value
  451. || conditional<
  452. is_executor<T>::value,
  453. false_type,
  454. is_sender<T>
  455. >::type::value
  456. || conditional<
  457. is_executor<T>::value,
  458. false_type,
  459. is_scheduler<T>
  460. >::type::value
  461. ));
  462. # endif // defined(BOOST_ASIO_NO_DEPRECATED)
  463. #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  464. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
  465. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
  466. typedef bulk_guarantee_t<I> polymorphic_query_result_type;
  467. BOOST_ASIO_CONSTEXPR unsequenced_t()
  468. {
  469. }
  470. template <typename T>
  471. struct query_member :
  472. traits::query_member<
  473. typename bulk_guarantee_t<I>::template proxy<T>::type,
  474. unsequenced_t> {};
  475. template <typename T>
  476. struct query_static_constexpr_member :
  477. traits::query_static_constexpr_member<
  478. typename bulk_guarantee_t<I>::template static_proxy<T>::type,
  479. unsequenced_t> {};
  480. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  481. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  482. template <typename T>
  483. static BOOST_ASIO_CONSTEXPR
  484. typename query_static_constexpr_member<T>::result_type
  485. static_query()
  486. BOOST_ASIO_NOEXCEPT_IF((
  487. query_static_constexpr_member<T>::is_noexcept))
  488. {
  489. return query_static_constexpr_member<T>::value();
  490. }
  491. template <typename T>
  492. static BOOST_ASIO_CONSTEXPR unsequenced_t static_query(
  493. typename enable_if<
  494. !query_static_constexpr_member<T>::is_valid
  495. >::type* = 0,
  496. typename enable_if<
  497. !query_member<T>::is_valid
  498. >::type* = 0,
  499. typename enable_if<
  500. !traits::query_free<T, unsequenced_t>::is_valid
  501. >::type* = 0,
  502. typename enable_if<
  503. !can_query<T, sequenced_t<I> >::value
  504. >::type* = 0,
  505. typename enable_if<
  506. !can_query<T, parallel_t<I> >::value
  507. >::type* = 0) BOOST_ASIO_NOEXCEPT
  508. {
  509. return unsequenced_t();
  510. }
  511. template <typename E, typename T = decltype(unsequenced_t::static_query<E>())>
  512. static BOOST_ASIO_CONSTEXPR const T static_query_v
  513. = unsequenced_t::static_query<E>();
  514. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  515. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  516. static BOOST_ASIO_CONSTEXPR bulk_guarantee_t<I> value()
  517. {
  518. return unsequenced_t();
  519. }
  520. friend BOOST_ASIO_CONSTEXPR bool operator==(
  521. const unsequenced_t&, const unsequenced_t&)
  522. {
  523. return true;
  524. }
  525. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  526. const unsequenced_t&, const unsequenced_t&)
  527. {
  528. return false;
  529. }
  530. friend BOOST_ASIO_CONSTEXPR bool operator==(
  531. const unsequenced_t&, const sequenced_t<I>&)
  532. {
  533. return false;
  534. }
  535. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  536. const unsequenced_t&, const sequenced_t<I>&)
  537. {
  538. return true;
  539. }
  540. friend BOOST_ASIO_CONSTEXPR bool operator==(
  541. const unsequenced_t&, const parallel_t<I>&)
  542. {
  543. return false;
  544. }
  545. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  546. const unsequenced_t&, const parallel_t<I>&)
  547. {
  548. return true;
  549. }
  550. };
  551. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  552. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  553. template <int I> template <typename E, typename T>
  554. const T unsequenced_t<I>::static_query_v;
  555. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  556. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  557. template <int I = 0>
  558. struct sequenced_t
  559. {
  560. #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  561. # if defined(BOOST_ASIO_NO_DEPRECATED)
  562. template <typename T>
  563. BOOST_ASIO_STATIC_CONSTEXPR(bool,
  564. is_applicable_property_v = (
  565. is_executor<T>::value));
  566. # else // defined(BOOST_ASIO_NO_DEPRECATED)
  567. template <typename T>
  568. BOOST_ASIO_STATIC_CONSTEXPR(bool,
  569. is_applicable_property_v = (
  570. is_executor<T>::value
  571. || conditional<
  572. is_executor<T>::value,
  573. false_type,
  574. is_sender<T>
  575. >::type::value
  576. || conditional<
  577. is_executor<T>::value,
  578. false_type,
  579. is_scheduler<T>
  580. >::type::value
  581. ));
  582. # endif // defined(BOOST_ASIO_NO_DEPRECATED)
  583. #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  584. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
  585. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
  586. typedef bulk_guarantee_t<I> polymorphic_query_result_type;
  587. BOOST_ASIO_CONSTEXPR sequenced_t()
  588. {
  589. }
  590. template <typename T>
  591. struct query_member :
  592. traits::query_member<
  593. typename bulk_guarantee_t<I>::template proxy<T>::type,
  594. sequenced_t> {};
  595. template <typename T>
  596. struct query_static_constexpr_member :
  597. traits::query_static_constexpr_member<
  598. typename bulk_guarantee_t<I>::template static_proxy<T>::type,
  599. sequenced_t> {};
  600. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  601. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  602. template <typename T>
  603. static BOOST_ASIO_CONSTEXPR
  604. typename query_static_constexpr_member<T>::result_type
  605. static_query()
  606. BOOST_ASIO_NOEXCEPT_IF((
  607. query_static_constexpr_member<T>::is_noexcept))
  608. {
  609. return query_static_constexpr_member<T>::value();
  610. }
  611. template <typename E, typename T = decltype(sequenced_t::static_query<E>())>
  612. static BOOST_ASIO_CONSTEXPR const T static_query_v
  613. = sequenced_t::static_query<E>();
  614. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  615. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  616. static BOOST_ASIO_CONSTEXPR bulk_guarantee_t<I> value()
  617. {
  618. return sequenced_t();
  619. }
  620. friend BOOST_ASIO_CONSTEXPR bool operator==(
  621. const sequenced_t&, const sequenced_t&)
  622. {
  623. return true;
  624. }
  625. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  626. const sequenced_t&, const sequenced_t&)
  627. {
  628. return false;
  629. }
  630. friend BOOST_ASIO_CONSTEXPR bool operator==(
  631. const sequenced_t&, const unsequenced_t<I>&)
  632. {
  633. return false;
  634. }
  635. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  636. const sequenced_t&, const unsequenced_t<I>&)
  637. {
  638. return true;
  639. }
  640. friend BOOST_ASIO_CONSTEXPR bool operator==(
  641. const sequenced_t&, const parallel_t<I>&)
  642. {
  643. return false;
  644. }
  645. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  646. const sequenced_t&, const parallel_t<I>&)
  647. {
  648. return true;
  649. }
  650. };
  651. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  652. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  653. template <int I> template <typename E, typename T>
  654. const T sequenced_t<I>::static_query_v;
  655. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  656. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  657. template <int I>
  658. struct parallel_t
  659. {
  660. #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  661. # if defined(BOOST_ASIO_NO_DEPRECATED)
  662. template <typename T>
  663. BOOST_ASIO_STATIC_CONSTEXPR(bool,
  664. is_applicable_property_v = (
  665. is_executor<T>::value));
  666. # else // defined(BOOST_ASIO_NO_DEPRECATED)
  667. template <typename T>
  668. BOOST_ASIO_STATIC_CONSTEXPR(bool,
  669. is_applicable_property_v = (
  670. is_executor<T>::value
  671. || conditional<
  672. is_executor<T>::value,
  673. false_type,
  674. is_sender<T>
  675. >::type::value
  676. || conditional<
  677. is_executor<T>::value,
  678. false_type,
  679. is_scheduler<T>
  680. >::type::value
  681. ));
  682. # endif // defined(BOOST_ASIO_NO_DEPRECATED)
  683. #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  684. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
  685. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
  686. typedef bulk_guarantee_t<I> polymorphic_query_result_type;
  687. BOOST_ASIO_CONSTEXPR parallel_t()
  688. {
  689. }
  690. template <typename T>
  691. struct query_member :
  692. traits::query_member<
  693. typename bulk_guarantee_t<I>::template proxy<T>::type,
  694. parallel_t> {};
  695. template <typename T>
  696. struct query_static_constexpr_member :
  697. traits::query_static_constexpr_member<
  698. typename bulk_guarantee_t<I>::template static_proxy<T>::type,
  699. parallel_t> {};
  700. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  701. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  702. template <typename T>
  703. static BOOST_ASIO_CONSTEXPR
  704. typename query_static_constexpr_member<T>::result_type
  705. static_query()
  706. BOOST_ASIO_NOEXCEPT_IF((
  707. query_static_constexpr_member<T>::is_noexcept))
  708. {
  709. return query_static_constexpr_member<T>::value();
  710. }
  711. template <typename E, typename T = decltype(parallel_t::static_query<E>())>
  712. static BOOST_ASIO_CONSTEXPR const T static_query_v
  713. = parallel_t::static_query<E>();
  714. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  715. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  716. static BOOST_ASIO_CONSTEXPR bulk_guarantee_t<I> value()
  717. {
  718. return parallel_t();
  719. }
  720. friend BOOST_ASIO_CONSTEXPR bool operator==(
  721. const parallel_t&, const parallel_t&)
  722. {
  723. return true;
  724. }
  725. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  726. const parallel_t&, const parallel_t&)
  727. {
  728. return false;
  729. }
  730. friend BOOST_ASIO_CONSTEXPR bool operator==(
  731. const parallel_t&, const unsequenced_t<I>&)
  732. {
  733. return false;
  734. }
  735. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  736. const parallel_t&, const unsequenced_t<I>&)
  737. {
  738. return true;
  739. }
  740. friend BOOST_ASIO_CONSTEXPR bool operator==(
  741. const parallel_t&, const sequenced_t<I>&)
  742. {
  743. return false;
  744. }
  745. friend BOOST_ASIO_CONSTEXPR bool operator!=(
  746. const parallel_t&, const sequenced_t<I>&)
  747. {
  748. return true;
  749. }
  750. };
  751. #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  752. && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  753. template <int I> template <typename E, typename T>
  754. const T parallel_t<I>::static_query_v;
  755. #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  756. // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  757. } // namespace bulk_guarantee
  758. } // namespace detail
  759. typedef detail::bulk_guarantee_t<> bulk_guarantee_t;
  760. #if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
  761. constexpr bulk_guarantee_t bulk_guarantee;
  762. #else // defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
  763. namespace { static const bulk_guarantee_t&
  764. bulk_guarantee = bulk_guarantee_t::instance; }
  765. #endif
  766. } // namespace execution
  767. #if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  768. template <typename T>
  769. struct is_applicable_property<T, execution::bulk_guarantee_t>
  770. : integral_constant<bool,
  771. execution::is_executor<T>::value
  772. || conditional<
  773. execution::is_executor<T>::value,
  774. false_type,
  775. execution::is_sender<T>
  776. >::type::value
  777. || conditional<
  778. execution::is_executor<T>::value,
  779. false_type,
  780. execution::is_scheduler<T>
  781. >::type::value>
  782. {
  783. };
  784. template <typename T>
  785. struct is_applicable_property<T, execution::bulk_guarantee_t::unsequenced_t>
  786. : integral_constant<bool,
  787. execution::is_executor<T>::value
  788. || conditional<
  789. execution::is_executor<T>::value,
  790. false_type,
  791. execution::is_sender<T>
  792. >::type::value
  793. || conditional<
  794. execution::is_executor<T>::value,
  795. false_type,
  796. execution::is_scheduler<T>
  797. >::type::value>
  798. {
  799. };
  800. template <typename T>
  801. struct is_applicable_property<T, execution::bulk_guarantee_t::sequenced_t>
  802. : integral_constant<bool,
  803. execution::is_executor<T>::value
  804. || conditional<
  805. execution::is_executor<T>::value,
  806. false_type,
  807. execution::is_sender<T>
  808. >::type::value
  809. || conditional<
  810. execution::is_executor<T>::value,
  811. false_type,
  812. execution::is_scheduler<T>
  813. >::type::value>
  814. {
  815. };
  816. template <typename T>
  817. struct is_applicable_property<T, execution::bulk_guarantee_t::parallel_t>
  818. : integral_constant<bool,
  819. execution::is_executor<T>::value
  820. || conditional<
  821. execution::is_executor<T>::value,
  822. false_type,
  823. execution::is_sender<T>
  824. >::type::value
  825. || conditional<
  826. execution::is_executor<T>::value,
  827. false_type,
  828. execution::is_scheduler<T>
  829. >::type::value>
  830. {
  831. };
  832. #endif // !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  833. namespace traits {
  834. #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
  835. template <typename T>
  836. struct query_free_default<T, execution::bulk_guarantee_t,
  837. typename enable_if<
  838. can_query<T, execution::bulk_guarantee_t::unsequenced_t>::value
  839. >::type>
  840. {
  841. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  842. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
  843. (is_nothrow_query<T, execution::bulk_guarantee_t::unsequenced_t>::value));
  844. typedef execution::bulk_guarantee_t result_type;
  845. };
  846. template <typename T>
  847. struct query_free_default<T, execution::bulk_guarantee_t,
  848. typename enable_if<
  849. !can_query<T, execution::bulk_guarantee_t::unsequenced_t>::value
  850. && can_query<T, execution::bulk_guarantee_t::sequenced_t>::value
  851. >::type>
  852. {
  853. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  854. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
  855. (is_nothrow_query<T, execution::bulk_guarantee_t::sequenced_t>::value));
  856. typedef execution::bulk_guarantee_t result_type;
  857. };
  858. template <typename T>
  859. struct query_free_default<T, execution::bulk_guarantee_t,
  860. typename enable_if<
  861. !can_query<T, execution::bulk_guarantee_t::unsequenced_t>::value
  862. && !can_query<T, execution::bulk_guarantee_t::sequenced_t>::value
  863. && can_query<T, execution::bulk_guarantee_t::parallel_t>::value
  864. >::type>
  865. {
  866. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  867. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
  868. (is_nothrow_query<T, execution::bulk_guarantee_t::parallel_t>::value));
  869. typedef execution::bulk_guarantee_t result_type;
  870. };
  871. #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
  872. #if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  873. || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  874. template <typename T>
  875. struct static_query<T, execution::bulk_guarantee_t,
  876. typename enable_if<
  877. execution::detail::bulk_guarantee_t<0>::
  878. query_static_constexpr_member<T>::is_valid
  879. >::type>
  880. {
  881. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  882. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  883. typedef typename execution::detail::bulk_guarantee_t<0>::
  884. query_static_constexpr_member<T>::result_type result_type;
  885. static BOOST_ASIO_CONSTEXPR result_type value()
  886. {
  887. return execution::detail::bulk_guarantee_t<0>::
  888. query_static_constexpr_member<T>::value();
  889. }
  890. };
  891. template <typename T>
  892. struct static_query<T, execution::bulk_guarantee_t,
  893. typename enable_if<
  894. !execution::detail::bulk_guarantee_t<0>::
  895. query_static_constexpr_member<T>::is_valid
  896. && !execution::detail::bulk_guarantee_t<0>::
  897. query_member<T>::is_valid
  898. && traits::static_query<T,
  899. execution::bulk_guarantee_t::unsequenced_t>::is_valid
  900. >::type>
  901. {
  902. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  903. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  904. typedef typename traits::static_query<T,
  905. execution::bulk_guarantee_t::unsequenced_t>::result_type result_type;
  906. static BOOST_ASIO_CONSTEXPR result_type value()
  907. {
  908. return traits::static_query<T,
  909. execution::bulk_guarantee_t::unsequenced_t>::value();
  910. }
  911. };
  912. template <typename T>
  913. struct static_query<T, execution::bulk_guarantee_t,
  914. typename enable_if<
  915. !execution::detail::bulk_guarantee_t<0>::
  916. query_static_constexpr_member<T>::is_valid
  917. && !execution::detail::bulk_guarantee_t<0>::
  918. query_member<T>::is_valid
  919. && !traits::static_query<T,
  920. execution::bulk_guarantee_t::unsequenced_t>::is_valid
  921. && traits::static_query<T,
  922. execution::bulk_guarantee_t::sequenced_t>::is_valid
  923. >::type>
  924. {
  925. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  926. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  927. typedef typename traits::static_query<T,
  928. execution::bulk_guarantee_t::sequenced_t>::result_type result_type;
  929. static BOOST_ASIO_CONSTEXPR result_type value()
  930. {
  931. return traits::static_query<T,
  932. execution::bulk_guarantee_t::sequenced_t>::value();
  933. }
  934. };
  935. template <typename T>
  936. struct static_query<T, execution::bulk_guarantee_t,
  937. typename enable_if<
  938. !execution::detail::bulk_guarantee_t<0>::
  939. query_static_constexpr_member<T>::is_valid
  940. && !execution::detail::bulk_guarantee_t<0>::
  941. query_member<T>::is_valid
  942. && !traits::static_query<T,
  943. execution::bulk_guarantee_t::unsequenced_t>::is_valid
  944. && !traits::static_query<T,
  945. execution::bulk_guarantee_t::sequenced_t>::is_valid
  946. && traits::static_query<T,
  947. execution::bulk_guarantee_t::parallel_t>::is_valid
  948. >::type>
  949. {
  950. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  951. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  952. typedef typename traits::static_query<T,
  953. execution::bulk_guarantee_t::parallel_t>::result_type result_type;
  954. static BOOST_ASIO_CONSTEXPR result_type value()
  955. {
  956. return traits::static_query<T,
  957. execution::bulk_guarantee_t::parallel_t>::value();
  958. }
  959. };
  960. template <typename T>
  961. struct static_query<T, execution::bulk_guarantee_t::unsequenced_t,
  962. typename enable_if<
  963. execution::detail::bulk_guarantee::unsequenced_t<0>::
  964. query_static_constexpr_member<T>::is_valid
  965. >::type>
  966. {
  967. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  968. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  969. typedef typename execution::detail::bulk_guarantee::unsequenced_t<0>::
  970. query_static_constexpr_member<T>::result_type result_type;
  971. static BOOST_ASIO_CONSTEXPR result_type value()
  972. {
  973. return execution::detail::bulk_guarantee::unsequenced_t<0>::
  974. query_static_constexpr_member<T>::value();
  975. }
  976. };
  977. template <typename T>
  978. struct static_query<T, execution::bulk_guarantee_t::unsequenced_t,
  979. typename enable_if<
  980. !execution::detail::bulk_guarantee::unsequenced_t<0>::
  981. query_static_constexpr_member<T>::is_valid
  982. && !execution::detail::bulk_guarantee::unsequenced_t<0>::
  983. query_member<T>::is_valid
  984. && !traits::query_free<T,
  985. execution::bulk_guarantee_t::unsequenced_t>::is_valid
  986. && !can_query<T, execution::bulk_guarantee_t::sequenced_t>::value
  987. && !can_query<T, execution::bulk_guarantee_t::parallel_t>::value
  988. >::type>
  989. {
  990. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  991. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  992. typedef execution::bulk_guarantee_t::unsequenced_t result_type;
  993. static BOOST_ASIO_CONSTEXPR result_type value()
  994. {
  995. return result_type();
  996. }
  997. };
  998. template <typename T>
  999. struct static_query<T, execution::bulk_guarantee_t::sequenced_t,
  1000. typename enable_if<
  1001. execution::detail::bulk_guarantee::sequenced_t<0>::
  1002. query_static_constexpr_member<T>::is_valid
  1003. >::type>
  1004. {
  1005. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  1006. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  1007. typedef typename execution::detail::bulk_guarantee::sequenced_t<0>::
  1008. query_static_constexpr_member<T>::result_type result_type;
  1009. static BOOST_ASIO_CONSTEXPR result_type value()
  1010. {
  1011. return execution::detail::bulk_guarantee::sequenced_t<0>::
  1012. query_static_constexpr_member<T>::value();
  1013. }
  1014. };
  1015. template <typename T>
  1016. struct static_query<T, execution::bulk_guarantee_t::parallel_t,
  1017. typename enable_if<
  1018. execution::detail::bulk_guarantee::parallel_t<0>::
  1019. query_static_constexpr_member<T>::is_valid
  1020. >::type>
  1021. {
  1022. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  1023. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  1024. typedef typename execution::detail::bulk_guarantee::parallel_t<0>::
  1025. query_static_constexpr_member<T>::result_type result_type;
  1026. static BOOST_ASIO_CONSTEXPR result_type value()
  1027. {
  1028. return execution::detail::bulk_guarantee::parallel_t<0>::
  1029. query_static_constexpr_member<T>::value();
  1030. }
  1031. };
  1032. #endif // !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  1033. // || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  1034. #if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
  1035. template <typename T>
  1036. struct static_require<T, execution::bulk_guarantee_t::unsequenced_t,
  1037. typename enable_if<
  1038. static_query<T, execution::bulk_guarantee_t::unsequenced_t>::is_valid
  1039. >::type>
  1040. {
  1041. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid =
  1042. (is_same<typename static_query<T,
  1043. execution::bulk_guarantee_t::unsequenced_t>::result_type,
  1044. execution::bulk_guarantee_t::unsequenced_t>::value));
  1045. };
  1046. template <typename T>
  1047. struct static_require<T, execution::bulk_guarantee_t::sequenced_t,
  1048. typename enable_if<
  1049. static_query<T, execution::bulk_guarantee_t::sequenced_t>::is_valid
  1050. >::type>
  1051. {
  1052. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid =
  1053. (is_same<typename static_query<T,
  1054. execution::bulk_guarantee_t::sequenced_t>::result_type,
  1055. execution::bulk_guarantee_t::sequenced_t>::value));
  1056. };
  1057. template <typename T>
  1058. struct static_require<T, execution::bulk_guarantee_t::parallel_t,
  1059. typename enable_if<
  1060. static_query<T, execution::bulk_guarantee_t::parallel_t>::is_valid
  1061. >::type>
  1062. {
  1063. BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid =
  1064. (is_same<typename static_query<T,
  1065. execution::bulk_guarantee_t::parallel_t>::result_type,
  1066. execution::bulk_guarantee_t::parallel_t>::value));
  1067. };
  1068. #endif // !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
  1069. } // namespace traits
  1070. #endif // defined(GENERATING_DOCUMENTATION)
  1071. } // namespace asio
  1072. } // namespace boost
  1073. #include <boost/asio/detail/pop_options.hpp>
  1074. #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
  1075. #endif // BOOST_ASIO_EXECUTION_BULK_GUARANTEE_HPP