2 // execution/outstanding_work.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
11 #ifndef BOOST_ASIO_EXECUTION_OUTSTANDING_WORK_HPP
12 #define BOOST_ASIO_EXECUTION_OUTSTANDING_WORK_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/detail/type_traits.hpp>
20 #include <boost/asio/execution/executor.hpp>
21 #include <boost/asio/execution/scheduler.hpp>
22 #include <boost/asio/execution/sender.hpp>
23 #include <boost/asio/is_applicable_property.hpp>
24 #include <boost/asio/query.hpp>
25 #include <boost/asio/traits/query_free.hpp>
26 #include <boost/asio/traits/query_member.hpp>
27 #include <boost/asio/traits/query_static_constexpr_member.hpp>
28 #include <boost/asio/traits/static_query.hpp>
29 #include <boost/asio/traits/static_require.hpp>
31 #include <boost/asio/detail/push_options.hpp>
36 #if defined(GENERATING_DOCUMENTATION)
40 /// A property to describe whether task submission is likely in the future.
41 struct outstanding_work_t
43 /// The outstanding_work_t property applies to executors, senders, and
46 static constexpr bool is_applicable_property_v =
47 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
49 /// The top-level outstanding_work_t property cannot be required.
50 static constexpr bool is_requirable = false;
52 /// The top-level outstanding_work_t property cannot be preferred.
53 static constexpr bool is_preferable = false;
55 /// The type returned by queries against an @c any_executor.
56 typedef outstanding_work_t polymorphic_query_result_type;
58 /// A sub-property that indicates that the executor does not represent likely
59 /// future submission of a function object.
62 /// The outstanding_work_t::untracked_t property applies to executors,
63 /// senders, and schedulers.
65 static constexpr bool is_applicable_property_v =
66 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
68 /// The outstanding_work_t::untracked_t property can be required.
69 static constexpr bool is_requirable = true;
71 /// The outstanding_work_t::untracked_t property can be preferred.
72 static constexpr bool is_preferable = true;
74 /// The type returned by queries against an @c any_executor.
75 typedef outstanding_work_t polymorphic_query_result_type;
77 /// Default constructor.
78 constexpr untracked_t();
80 /// Get the value associated with a property object.
82 * @returns untracked_t();
84 static constexpr outstanding_work_t value();
87 /// A sub-property that indicates that the executor represents likely
88 /// future submission of a function object.
91 /// The outstanding_work_t::untracked_t property applies to executors,
92 /// senders, and schedulers.
94 static constexpr bool is_applicable_property_v =
95 is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
97 /// The outstanding_work_t::tracked_t property can be required.
98 static constexpr bool is_requirable = true;
100 /// The outstanding_work_t::tracked_t property can be preferred.
101 static constexpr bool is_preferable = true;
103 /// The type returned by queries against an @c any_executor.
104 typedef outstanding_work_t polymorphic_query_result_type;
106 /// Default constructor.
107 constexpr tracked_t();
109 /// Get the value associated with a property object.
111 * @returns tracked_t();
113 static constexpr outstanding_work_t value();
116 /// A special value used for accessing the outstanding_work_t::untracked_t
118 static constexpr untracked_t untracked;
120 /// A special value used for accessing the outstanding_work_t::tracked_t
122 static constexpr tracked_t tracked;
124 /// Default constructor.
125 constexpr outstanding_work_t();
127 /// Construct from a sub-property value.
128 constexpr outstanding_work_t(untracked_t);
130 /// Construct from a sub-property value.
131 constexpr outstanding_work_t(tracked_t);
133 /// Compare property values for equality.
134 friend constexpr bool operator==(
135 const outstanding_work_t& a, const outstanding_work_t& b) noexcept;
137 /// Compare property values for inequality.
138 friend constexpr bool operator!=(
139 const outstanding_work_t& a, const outstanding_work_t& b) noexcept;
142 /// A special value used for accessing the outstanding_work_t property.
143 constexpr outstanding_work_t outstanding_work;
145 } // namespace execution
147 #else // defined(GENERATING_DOCUMENTATION)
149 namespace execution {
151 namespace outstanding_work {
153 template <int I> struct untracked_t;
154 template <int I> struct tracked_t;
156 } // namespace outstanding_work
159 struct outstanding_work_t
161 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
162 template <typename T>
163 BOOST_ASIO_STATIC_CONSTEXPR(bool,
164 is_applicable_property_v = (
165 is_executor<T>::value
167 is_executor<T>::value,
172 is_executor<T>::value,
176 #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
178 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
179 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
180 typedef outstanding_work_t polymorphic_query_result_type;
182 typedef detail::outstanding_work::untracked_t<I> untracked_t;
183 typedef detail::outstanding_work::tracked_t<I> tracked_t;
185 BOOST_ASIO_CONSTEXPR outstanding_work_t()
190 BOOST_ASIO_CONSTEXPR outstanding_work_t(untracked_t)
195 BOOST_ASIO_CONSTEXPR outstanding_work_t(tracked_t)
200 template <typename T>
203 #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
206 template <typename P>
207 auto query(BOOST_ASIO_MOVE_ARG(P) p) const
210 declval<typename conditional<true, T, P>::type>().query(
211 BOOST_ASIO_MOVE_CAST(P)(p))
215 declval<typename conditional<true, T, P>::type>().query(
216 BOOST_ASIO_MOVE_CAST(P)(p))
219 #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
221 #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
224 template <typename T>
227 #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
230 template <typename P>
231 static constexpr auto query(BOOST_ASIO_MOVE_ARG(P) p)
234 conditional<true, T, P>::type::query(BOOST_ASIO_MOVE_CAST(P)(p))
238 conditional<true, T, P>::type::query(BOOST_ASIO_MOVE_CAST(P)(p))
241 return T::query(BOOST_ASIO_MOVE_CAST(P)(p));
244 #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
246 #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
249 template <typename T>
250 struct query_member :
251 traits::query_member<typename proxy<T>::type, outstanding_work_t> {};
253 template <typename T>
254 struct query_static_constexpr_member :
255 traits::query_static_constexpr_member<
256 typename static_proxy<T>::type, outstanding_work_t> {};
258 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
259 && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
260 template <typename T>
261 static BOOST_ASIO_CONSTEXPR
262 typename query_static_constexpr_member<T>::result_type
264 BOOST_ASIO_NOEXCEPT_IF((
265 query_static_constexpr_member<T>::is_noexcept))
267 return query_static_constexpr_member<T>::value();
270 template <typename T>
271 static BOOST_ASIO_CONSTEXPR
272 typename traits::static_query<T, untracked_t>::result_type
275 !query_static_constexpr_member<T>::is_valid
278 !query_member<T>::is_valid
281 traits::static_query<T, untracked_t>::is_valid
282 >::type* = 0) BOOST_ASIO_NOEXCEPT
284 return traits::static_query<T, untracked_t>::value();
287 template <typename T>
288 static BOOST_ASIO_CONSTEXPR
289 typename traits::static_query<T, tracked_t>::result_type
292 !query_static_constexpr_member<T>::is_valid
295 !query_member<T>::is_valid
298 !traits::static_query<T, untracked_t>::is_valid
301 traits::static_query<T, tracked_t>::is_valid
302 >::type* = 0) BOOST_ASIO_NOEXCEPT
304 return traits::static_query<T, tracked_t>::value();
307 template <typename E,
308 typename T = decltype(outstanding_work_t::static_query<E>())>
309 static BOOST_ASIO_CONSTEXPR const T static_query_v
310 = outstanding_work_t::static_query<E>();
311 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
312 // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
314 friend BOOST_ASIO_CONSTEXPR bool operator==(
315 const outstanding_work_t& a, const outstanding_work_t& b)
317 return a.value_ == b.value_;
320 friend BOOST_ASIO_CONSTEXPR bool operator!=(
321 const outstanding_work_t& a, const outstanding_work_t& b)
323 return a.value_ != b.value_;
326 struct convertible_from_outstanding_work_t
328 BOOST_ASIO_CONSTEXPR convertible_from_outstanding_work_t(outstanding_work_t)
333 template <typename Executor>
334 friend BOOST_ASIO_CONSTEXPR outstanding_work_t query(
335 const Executor& ex, convertible_from_outstanding_work_t,
337 can_query<const Executor&, untracked_t>::value
339 #if !defined(__clang__) // Clang crashes if noexcept is used here.
340 #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
341 BOOST_ASIO_NOEXCEPT_IF((
342 is_nothrow_query<const Executor&,
343 outstanding_work_t<>::untracked_t>::value))
344 #else // defined(BOOST_ASIO_MSVC)
345 BOOST_ASIO_NOEXCEPT_IF((
346 is_nothrow_query<const Executor&, untracked_t>::value))
347 #endif // defined(BOOST_ASIO_MSVC)
348 #endif // !defined(__clang__)
350 return boost::asio::query(ex, untracked_t());
353 template <typename Executor>
354 friend BOOST_ASIO_CONSTEXPR outstanding_work_t query(
355 const Executor& ex, convertible_from_outstanding_work_t,
357 !can_query<const Executor&, untracked_t>::value
360 can_query<const Executor&, tracked_t>::value
362 #if !defined(__clang__) // Clang crashes if noexcept is used here.
363 #if defined(BOOST_ASIO_MSVC) // Visual C++ wants the type to be qualified.
364 BOOST_ASIO_NOEXCEPT_IF((
365 is_nothrow_query<const Executor&,
366 outstanding_work_t<>::tracked_t>::value))
367 #else // defined(BOOST_ASIO_MSVC)
368 BOOST_ASIO_NOEXCEPT_IF((
369 is_nothrow_query<const Executor&, tracked_t>::value))
370 #endif // defined(BOOST_ASIO_MSVC)
371 #endif // !defined(__clang__)
373 return boost::asio::query(ex, tracked_t());
376 BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(untracked_t, untracked);
377 BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(tracked_t, tracked);
379 #if !defined(BOOST_ASIO_HAS_CONSTEXPR)
380 static const outstanding_work_t instance;
381 #endif // !defined(BOOST_ASIO_HAS_CONSTEXPR)
387 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
388 && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
389 template <int I> template <typename E, typename T>
390 const T outstanding_work_t<I>::static_query_v;
391 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
392 // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
394 #if !defined(BOOST_ASIO_HAS_CONSTEXPR)
396 const outstanding_work_t<I> outstanding_work_t<I>::instance;
400 const typename outstanding_work_t<I>::untracked_t
401 outstanding_work_t<I>::untracked;
404 const typename outstanding_work_t<I>::tracked_t
405 outstanding_work_t<I>::tracked;
407 namespace outstanding_work {
412 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
413 template <typename T>
414 BOOST_ASIO_STATIC_CONSTEXPR(bool,
415 is_applicable_property_v = (
416 is_executor<T>::value
418 is_executor<T>::value,
423 is_executor<T>::value,
427 #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
429 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
430 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
431 typedef outstanding_work_t<I> polymorphic_query_result_type;
433 BOOST_ASIO_CONSTEXPR untracked_t()
437 template <typename T>
438 struct query_member :
439 traits::query_member<
440 typename outstanding_work_t<I>::template proxy<T>::type, untracked_t> {};
442 template <typename T>
443 struct query_static_constexpr_member :
444 traits::query_static_constexpr_member<
445 typename outstanding_work_t<I>::template static_proxy<T>::type,
448 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
449 && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
450 template <typename T>
451 static BOOST_ASIO_CONSTEXPR
452 typename query_static_constexpr_member<T>::result_type
454 BOOST_ASIO_NOEXCEPT_IF((
455 query_static_constexpr_member<T>::is_noexcept))
457 return query_static_constexpr_member<T>::value();
460 template <typename T>
461 static BOOST_ASIO_CONSTEXPR untracked_t static_query(
463 !query_static_constexpr_member<T>::is_valid
466 !query_member<T>::is_valid
469 !traits::query_free<T, untracked_t>::is_valid
472 !can_query<T, tracked_t<I> >::value
473 >::type* = 0) BOOST_ASIO_NOEXCEPT
475 return untracked_t();
478 template <typename E, typename T = decltype(untracked_t::static_query<E>())>
479 static BOOST_ASIO_CONSTEXPR const T static_query_v
480 = untracked_t::static_query<E>();
481 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
482 // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
484 static BOOST_ASIO_CONSTEXPR outstanding_work_t<I> value()
486 return untracked_t();
489 friend BOOST_ASIO_CONSTEXPR bool operator==(
490 const untracked_t&, const untracked_t&)
495 friend BOOST_ASIO_CONSTEXPR bool operator!=(
496 const untracked_t&, const untracked_t&)
502 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
503 && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
504 template <int I> template <typename E, typename T>
505 const T untracked_t<I>::static_query_v;
506 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
507 // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
512 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
513 template <typename T>
514 BOOST_ASIO_STATIC_CONSTEXPR(bool,
515 is_applicable_property_v = (
516 is_executor<T>::value
518 is_executor<T>::value,
523 is_executor<T>::value,
527 #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
529 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
530 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
531 typedef outstanding_work_t<I> polymorphic_query_result_type;
533 BOOST_ASIO_CONSTEXPR tracked_t()
537 template <typename T>
538 struct query_member :
539 traits::query_member<
540 typename outstanding_work_t<I>::template proxy<T>::type, tracked_t> {};
542 template <typename T>
543 struct query_static_constexpr_member :
544 traits::query_static_constexpr_member<
545 typename outstanding_work_t<I>::template static_proxy<T>::type,
548 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
549 && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
550 template <typename T>
551 static BOOST_ASIO_CONSTEXPR
552 typename query_static_constexpr_member<T>::result_type
554 BOOST_ASIO_NOEXCEPT_IF((
555 query_static_constexpr_member<T>::is_noexcept))
557 return query_static_constexpr_member<T>::value();
560 template <typename E, typename T = decltype(tracked_t::static_query<E>())>
561 static BOOST_ASIO_CONSTEXPR const T static_query_v
562 = tracked_t::static_query<E>();
563 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
564 // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
566 static BOOST_ASIO_CONSTEXPR outstanding_work_t<I> value()
571 friend BOOST_ASIO_CONSTEXPR bool operator==(
572 const tracked_t&, const tracked_t&)
577 friend BOOST_ASIO_CONSTEXPR bool operator!=(
578 const tracked_t&, const tracked_t&)
584 #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
585 && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
586 template <int I> template <typename E, typename T>
587 const T tracked_t<I>::static_query_v;
588 #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
589 // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
591 } // namespace outstanding_work
592 } // namespace detail
594 typedef detail::outstanding_work_t<> outstanding_work_t;
596 #if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
597 constexpr outstanding_work_t outstanding_work;
598 #else // defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
599 namespace { static const outstanding_work_t&
600 outstanding_work = outstanding_work_t::instance; }
603 } // namespace execution
605 #if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
607 template <typename T>
608 struct is_applicable_property<T, execution::outstanding_work_t>
609 : integral_constant<bool,
610 execution::is_executor<T>::value
612 execution::is_executor<T>::value,
614 execution::is_sender<T>
617 execution::is_executor<T>::value,
619 execution::is_scheduler<T>
624 template <typename T>
625 struct is_applicable_property<T, execution::outstanding_work_t::untracked_t>
626 : integral_constant<bool,
627 execution::is_executor<T>::value
629 execution::is_executor<T>::value,
631 execution::is_sender<T>
634 execution::is_executor<T>::value,
636 execution::is_scheduler<T>
641 template <typename T>
642 struct is_applicable_property<T, execution::outstanding_work_t::tracked_t>
643 : integral_constant<bool,
644 execution::is_executor<T>::value
646 execution::is_executor<T>::value,
648 execution::is_sender<T>
651 execution::is_executor<T>::value,
653 execution::is_scheduler<T>
658 #endif // !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
662 #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
664 template <typename T>
665 struct query_free_default<T, execution::outstanding_work_t,
667 can_query<T, execution::outstanding_work_t::untracked_t>::value
670 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
671 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
672 (is_nothrow_query<T, execution::outstanding_work_t::untracked_t>::value));
674 typedef execution::outstanding_work_t result_type;
677 template <typename T>
678 struct query_free_default<T, execution::outstanding_work_t,
680 !can_query<T, execution::outstanding_work_t::untracked_t>::value
681 && can_query<T, execution::outstanding_work_t::tracked_t>::value
684 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
685 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
686 (is_nothrow_query<T, execution::outstanding_work_t::tracked_t>::value));
688 typedef execution::outstanding_work_t result_type;
691 #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
693 #if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
694 || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
696 template <typename T>
697 struct static_query<T, execution::outstanding_work_t,
699 execution::detail::outstanding_work_t<0>::
700 query_static_constexpr_member<T>::is_valid
703 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
704 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
706 typedef typename execution::detail::outstanding_work_t<0>::
707 query_static_constexpr_member<T>::result_type result_type;
709 static BOOST_ASIO_CONSTEXPR result_type value()
711 return execution::detail::outstanding_work_t<0>::
712 query_static_constexpr_member<T>::value();
716 template <typename T>
717 struct static_query<T, execution::outstanding_work_t,
719 !execution::detail::outstanding_work_t<0>::
720 query_static_constexpr_member<T>::is_valid
721 && !execution::detail::outstanding_work_t<0>::
722 query_member<T>::is_valid
723 && traits::static_query<T,
724 execution::outstanding_work_t::untracked_t>::is_valid
727 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
728 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
730 typedef typename traits::static_query<T,
731 execution::outstanding_work_t::untracked_t>::result_type result_type;
733 static BOOST_ASIO_CONSTEXPR result_type value()
735 return traits::static_query<T,
736 execution::outstanding_work_t::untracked_t>::value();
740 template <typename T>
741 struct static_query<T, execution::outstanding_work_t,
743 !execution::detail::outstanding_work_t<0>::
744 query_static_constexpr_member<T>::is_valid
745 && !execution::detail::outstanding_work_t<0>::
746 query_member<T>::is_valid
747 && !traits::static_query<T,
748 execution::outstanding_work_t::untracked_t>::is_valid
749 && traits::static_query<T,
750 execution::outstanding_work_t::tracked_t>::is_valid
753 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
754 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
756 typedef typename traits::static_query<T,
757 execution::outstanding_work_t::tracked_t>::result_type result_type;
759 static BOOST_ASIO_CONSTEXPR result_type value()
761 return traits::static_query<T,
762 execution::outstanding_work_t::tracked_t>::value();
766 template <typename T>
767 struct static_query<T, execution::outstanding_work_t::untracked_t,
769 execution::detail::outstanding_work::untracked_t<0>::
770 query_static_constexpr_member<T>::is_valid
773 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
774 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
776 typedef typename execution::detail::outstanding_work::untracked_t<0>::
777 query_static_constexpr_member<T>::result_type result_type;
779 static BOOST_ASIO_CONSTEXPR result_type value()
781 return execution::detail::outstanding_work::untracked_t<0>::
782 query_static_constexpr_member<T>::value();
786 template <typename T>
787 struct static_query<T, execution::outstanding_work_t::untracked_t,
789 !execution::detail::outstanding_work::untracked_t<0>::
790 query_static_constexpr_member<T>::is_valid
791 && !execution::detail::outstanding_work::untracked_t<0>::
792 query_member<T>::is_valid
793 && !traits::query_free<T,
794 execution::outstanding_work_t::untracked_t>::is_valid
795 && !can_query<T, execution::outstanding_work_t::tracked_t>::value
798 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
799 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
801 typedef execution::outstanding_work_t::untracked_t result_type;
803 static BOOST_ASIO_CONSTEXPR result_type value()
805 return result_type();
809 template <typename T>
810 struct static_query<T, execution::outstanding_work_t::tracked_t,
812 execution::detail::outstanding_work::tracked_t<0>::
813 query_static_constexpr_member<T>::is_valid
816 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
817 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
819 typedef typename execution::detail::outstanding_work::tracked_t<0>::
820 query_static_constexpr_member<T>::result_type result_type;
822 static BOOST_ASIO_CONSTEXPR result_type value()
824 return execution::detail::outstanding_work::tracked_t<0>::
825 query_static_constexpr_member<T>::value();
829 #endif // !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
830 // || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
832 #if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
834 template <typename T>
835 struct static_require<T, execution::outstanding_work_t::untracked_t,
837 static_query<T, execution::outstanding_work_t::untracked_t>::is_valid
840 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid =
841 (is_same<typename static_query<T,
842 execution::outstanding_work_t::untracked_t>::result_type,
843 execution::outstanding_work_t::untracked_t>::value));
846 template <typename T>
847 struct static_require<T, execution::outstanding_work_t::tracked_t,
849 static_query<T, execution::outstanding_work_t::tracked_t>::is_valid
852 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid =
853 (is_same<typename static_query<T,
854 execution::outstanding_work_t::tracked_t>::result_type,
855 execution::outstanding_work_t::tracked_t>::value));
858 #endif // !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
860 } // namespace traits
862 #endif // defined(GENERATING_DOCUMENTATION)
867 #include <boost/asio/detail/pop_options.hpp>
869 #endif // BOOST_ASIO_EXECUTION_OUTSTANDING_WORK_HPP