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