Clementine
mapping.hpp
1 //
2 // execution/mapping.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 ASIO_EXECUTION_MAPPING_HPP
12 #define ASIO_EXECUTION_MAPPING_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 #include "asio/detail/type_traits.hpp"
20 #include "asio/execution/executor.hpp"
21 #include "asio/execution/scheduler.hpp"
22 #include "asio/execution/sender.hpp"
23 #include "asio/is_applicable_property.hpp"
24 #include "asio/query.hpp"
25 #include "asio/traits/query_free.hpp"
26 #include "asio/traits/query_member.hpp"
27 #include "asio/traits/query_static_constexpr_member.hpp"
28 #include "asio/traits/static_query.hpp"
29 #include "asio/traits/static_require.hpp"
30 
31 #include "asio/detail/push_options.hpp"
32 
33 namespace asio {
34 
35 #if defined(GENERATING_DOCUMENTATION)
36 
37 namespace execution {
38 
41 struct mapping_t
42 {
44  template <typename T>
45  static constexpr bool is_applicable_property_v =
46  is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
47 
49  static constexpr bool is_requirable = false;
50 
52  static constexpr bool is_preferable = false;
53 
55  typedef mapping_t polymorphic_query_result_type;
56 
59  struct thread_t
60  {
63  template <typename T>
64  static constexpr bool is_applicable_property_v =
65  is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
66 
68  static constexpr bool is_requirable = true;
69 
71  static constexpr bool is_preferable = true;
72 
74  typedef mapping_t polymorphic_query_result_type;
75 
77  constexpr thread_t();
78 
80 
83  static constexpr mapping_t value();
84  };
85 
88  struct new_thread_t
89  {
92  template <typename T>
93  static constexpr bool is_applicable_property_v =
94  is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
95 
97  static constexpr bool is_requirable = true;
98 
100  static constexpr bool is_preferable = true;
101 
103  typedef mapping_t polymorphic_query_result_type;
104 
106  constexpr new_thread_t();
107 
109 
112  static constexpr mapping_t value();
113  };
114 
117  struct other_t
118  {
121  template <typename T>
122  static constexpr bool is_applicable_property_v =
123  is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
124 
126  static constexpr bool is_requirable = true;
127 
129  static constexpr bool is_preferable = true;
130 
132  typedef mapping_t polymorphic_query_result_type;
133 
135  constexpr other_t();
136 
138 
141  static constexpr mapping_t value();
142  };
143 
145  static constexpr thread_t thread;
146 
148  static constexpr new_thread_t new_thread;
149 
151  static constexpr other_t other;
152 
154  constexpr mapping_t();
155 
157  constexpr mapping_t(thread_t);
158 
160  constexpr mapping_t(new_thread_t);
161 
163  constexpr mapping_t(other_t);
164 
166  friend constexpr bool operator==(
167  const mapping_t& a, const mapping_t& b) noexcept;
168 
170  friend constexpr bool operator!=(
171  const mapping_t& a, const mapping_t& b) noexcept;
172 };
173 
175 constexpr mapping_t mapping;
176 
177 } // namespace execution
178 
179 #else // defined(GENERATING_DOCUMENTATION)
180 
181 namespace execution {
182 namespace detail {
183 namespace mapping {
184 
185 template <int I> struct thread_t;
186 template <int I> struct new_thread_t;
187 template <int I> struct other_t;
188 
189 } // namespace mapping
190 
191 template <int I = 0>
192 struct mapping_t
193 {
194 #if defined(ASIO_HAS_VARIABLE_TEMPLATES)
195  template <typename T>
196  ASIO_STATIC_CONSTEXPR(bool,
197  is_applicable_property_v = is_executor<T>::value
199 #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
200 
201  ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
202  ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
204 
208 
209  ASIO_CONSTEXPR mapping_t()
210  : value_(-1)
211  {
212  }
213 
214  ASIO_CONSTEXPR mapping_t(thread_t)
215  : value_(0)
216  {
217  }
218 
219  ASIO_CONSTEXPR mapping_t(new_thread_t)
220  : value_(1)
221  {
222  }
223 
224  ASIO_CONSTEXPR mapping_t(other_t)
225  : value_(2)
226  {
227  }
228 
229 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
230  && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
231  template <typename T>
232  static ASIO_CONSTEXPR
234  static_query()
235  ASIO_NOEXCEPT_IF((
237  {
239  }
240 
241  template <typename T>
242  static ASIO_CONSTEXPR
244  static_query(
245  typename enable_if<
249  >::type* = 0) ASIO_NOEXCEPT
250  {
252  }
253 
254  template <typename T>
255  static ASIO_CONSTEXPR
257  static_query(
258  typename enable_if<
263  >::type* = 0) ASIO_NOEXCEPT
264  {
266  }
267 
268  template <typename T>
269  static ASIO_CONSTEXPR
271  static_query(
272  typename enable_if<
278  >::type* = 0) ASIO_NOEXCEPT
279  {
281  }
282 
283  template <typename E, typename T = decltype(mapping_t::static_query<E>())>
284  static ASIO_CONSTEXPR const T static_query_v
285  = mapping_t::static_query<E>();
286 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
287  // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
288 
289  friend ASIO_CONSTEXPR bool operator==(
290  const mapping_t& a, const mapping_t& b)
291  {
292  return a.value_ == b.value_;
293  }
294 
295  friend ASIO_CONSTEXPR bool operator!=(
296  const mapping_t& a, const mapping_t& b)
297  {
298  return a.value_ != b.value_;
299  }
300 
302  {
303  ASIO_CONSTEXPR convertible_from_mapping_t(mapping_t) {}
304  };
305 
306  template <typename Executor>
307  friend ASIO_CONSTEXPR mapping_t query(
308  const Executor& ex, convertible_from_mapping_t,
309  typename enable_if<
311  >::type* = 0)
312 #if !defined(__clang__) // Clang crashes if noexcept is used here.
313 #if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified.
314  ASIO_NOEXCEPT_IF((
315  is_nothrow_query<const Executor&, mapping_t<>::thread_t>::value))
316 #else // defined(ASIO_MSVC)
317  ASIO_NOEXCEPT_IF((
319 #endif // defined(ASIO_MSVC)
320 #endif // !defined(__clang__)
321  {
322  return asio::query(ex, thread_t());
323  }
324 
325  template <typename Executor>
326  friend ASIO_CONSTEXPR mapping_t query(
327  const Executor& ex, convertible_from_mapping_t,
328  typename enable_if<
331  >::type* = 0)
332 #if !defined(__clang__) // Clang crashes if noexcept is used here.
333 #if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified.
334  ASIO_NOEXCEPT_IF((
335  is_nothrow_query<const Executor&, mapping_t<>::new_thread_t>::value))
336 #else // defined(ASIO_MSVC)
337  ASIO_NOEXCEPT_IF((
339 #endif // defined(ASIO_MSVC)
340 #endif // !defined(__clang__)
341  {
342  return asio::query(ex, new_thread_t());
343  }
344 
345  template <typename Executor>
346  friend ASIO_CONSTEXPR mapping_t query(
347  const Executor& ex, convertible_from_mapping_t,
348  typename enable_if<
352  >::type* = 0)
353 #if !defined(__clang__) // Clang crashes if noexcept is used here.
354 #if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified.
355  ASIO_NOEXCEPT_IF((
356  is_nothrow_query<const Executor&, mapping_t<>::other_t>::value))
357 #else // defined(ASIO_MSVC)
358  ASIO_NOEXCEPT_IF((
360 #endif // defined(ASIO_MSVC)
361 #endif // !defined(__clang__)
362  {
363  return asio::query(ex, other_t());
364  }
365 
366  ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(thread_t, thread);
367  ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(new_thread_t, new_thread);
368  ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(other_t, other);
369 
370 #if !defined(ASIO_HAS_CONSTEXPR)
371  static const mapping_t instance;
372 #endif // !defined(ASIO_HAS_CONSTEXPR)
373 
374 private:
375  int value_;
376 };
377 
378 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
379  && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
380 template <int I> template <typename E, typename T>
382 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
383  // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
384 
385 #if !defined(ASIO_HAS_CONSTEXPR)
386 template <int I>
388 #endif
389 
390 template <int I>
392 
393 template <int I>
395 
396 template <int I>
398 
399 namespace mapping {
400 
401 template <int I = 0>
402 struct thread_t
403 {
404 #if defined(ASIO_HAS_VARIABLE_TEMPLATES)
405  template <typename T>
406  ASIO_STATIC_CONSTEXPR(bool,
407  is_applicable_property_v = is_executor<T>::value
409 #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
410 
411  ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
412  ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
414 
415  ASIO_CONSTEXPR thread_t()
416  {
417  }
418 
419 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
420  && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
421  template <typename T>
422  static ASIO_CONSTEXPR
424  static_query()
425  ASIO_NOEXCEPT_IF((
427  {
429  }
430 
431  template <typename T>
432  static ASIO_CONSTEXPR thread_t static_query(
433  typename enable_if<
437  && !can_query<T, new_thread_t<I> >::value
438  && !can_query<T, other_t<I> >::value
439  >::type* = 0) ASIO_NOEXCEPT
440  {
441  return thread_t();
442  }
443 
444  template <typename E, typename T = decltype(thread_t::static_query<E>())>
445  static ASIO_CONSTEXPR const T static_query_v
446  = thread_t::static_query<E>();
447 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
448  // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
449 
450  static ASIO_CONSTEXPR mapping_t<I> value()
451  {
452  return thread_t();
453  }
454 
455  friend ASIO_CONSTEXPR bool operator==(
456  const thread_t&, const thread_t&)
457  {
458  return true;
459  }
460 
461  friend ASIO_CONSTEXPR bool operator!=(
462  const thread_t&, const thread_t&)
463  {
464  return false;
465  }
466 };
467 
468 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
469  && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
470 template <int I> template <typename E, typename T>
472 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
473  // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
474 
475 template <int I = 0>
476 struct new_thread_t
477 {
478 #if defined(ASIO_HAS_VARIABLE_TEMPLATES)
479  template <typename T>
480  ASIO_STATIC_CONSTEXPR(bool,
481  is_applicable_property_v = is_executor<T>::value
483 #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
484 
485  ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
486  ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
488 
489  ASIO_CONSTEXPR new_thread_t()
490  {
491  }
492 
493 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
494  && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
495  template <typename T>
496  static ASIO_CONSTEXPR
498  static_query()
499  ASIO_NOEXCEPT_IF((
501  {
503  }
504 
505  template <typename E, typename T = decltype(new_thread_t::static_query<E>())>
506  static ASIO_CONSTEXPR const T static_query_v
507  = new_thread_t::static_query<E>();
508 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
509  // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
510 
511  static ASIO_CONSTEXPR mapping_t<I> value()
512  {
513  return new_thread_t();
514  }
515 
516  friend ASIO_CONSTEXPR bool operator==(
517  const new_thread_t&, const new_thread_t&)
518  {
519  return true;
520  }
521 
522  friend ASIO_CONSTEXPR bool operator!=(
523  const new_thread_t&, const new_thread_t&)
524  {
525  return false;
526  }
527 };
528 
529 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
530  && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
531 template <int I> template <typename E, typename T>
533 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
534  // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
535 
536 template <int I>
537 struct other_t
538 {
539 #if defined(ASIO_HAS_VARIABLE_TEMPLATES)
540  template <typename T>
541  ASIO_STATIC_CONSTEXPR(bool,
542  is_applicable_property_v = is_executor<T>::value
544 #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
545 
546  ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
547  ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
549 
550  ASIO_CONSTEXPR other_t()
551  {
552  }
553 
554 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
555  && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
556  template <typename T>
557  static ASIO_CONSTEXPR
559  static_query()
560  ASIO_NOEXCEPT_IF((
562  {
564  }
565 
566  template <typename E, typename T = decltype(other_t::static_query<E>())>
567  static ASIO_CONSTEXPR const T static_query_v
568  = other_t::static_query<E>();
569 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
570  // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
571 
572  static ASIO_CONSTEXPR mapping_t<I> value()
573  {
574  return other_t();
575  }
576 
577  friend ASIO_CONSTEXPR bool operator==(
578  const other_t&, const other_t&)
579  {
580  return true;
581  }
582 
583  friend ASIO_CONSTEXPR bool operator!=(
584  const other_t&, const other_t&)
585  {
586  return false;
587  }
588 };
589 
590 #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
591  && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
592 template <int I> template <typename E, typename T>
594 #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
595  // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
596 
597 } // namespace mapping
598 } // namespace detail
599 
601 
602 #if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
603 constexpr mapping_t mapping;
604 #else // defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
605 namespace { static const mapping_t& mapping = mapping_t::instance; }
606 #endif
607 
608 } // namespace execution
609 
610 #if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
611 
612 template <typename T>
613 struct is_applicable_property<T, execution::mapping_t>
614  : integral_constant<bool,
615  execution::is_executor<T>::value
616  || execution::is_sender<T>::value
617  || execution::is_scheduler<T>::value>
618 {
619 };
620 
621 template <typename T>
622 struct is_applicable_property<T, execution::mapping_t::thread_t>
623  : integral_constant<bool,
624  execution::is_executor<T>::value
625  || execution::is_sender<T>::value
626  || execution::is_scheduler<T>::value>
627 {
628 };
629 
630 template <typename T>
631 struct is_applicable_property<T, execution::mapping_t::new_thread_t>
632  : integral_constant<bool,
633  execution::is_executor<T>::value
634  || execution::is_sender<T>::value
635  || execution::is_scheduler<T>::value>
636 {
637 };
638 
639 template <typename T>
640 struct is_applicable_property<T, execution::mapping_t::other_t>
641  : integral_constant<bool,
642  execution::is_executor<T>::value
643  || execution::is_sender<T>::value
644  || execution::is_scheduler<T>::value>
645 {
646 };
647 
648 #endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
649 
650 namespace traits {
651 
652 #if !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
653 
654 template <typename T>
655 struct query_free_default<T, execution::mapping_t,
656  typename enable_if<
657  can_query<T, execution::mapping_t::thread_t>::value
658  >::type>
659 {
660  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
661  ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
663 
665 };
666 
667 template <typename T>
668 struct query_free_default<T, execution::mapping_t,
669  typename enable_if<
670  !can_query<T, execution::mapping_t::thread_t>::value
671  && can_query<T, execution::mapping_t::new_thread_t>::value
672  >::type>
673 {
674  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
675  ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
677 
679 };
680 
681 template <typename T>
682 struct query_free_default<T, execution::mapping_t,
683  typename enable_if<
684  !can_query<T, execution::mapping_t::thread_t>::value
685  && !can_query<T, execution::mapping_t::new_thread_t>::value
686  && can_query<T, execution::mapping_t::other_t>::value
687  >::type>
688 {
689  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
690  ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
692 
694 };
695 
696 #endif // !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
697 
698 #if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
699  || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
700 
701 template <typename T>
702 struct static_query<T, execution::mapping_t,
703  typename enable_if<
704  traits::query_static_constexpr_member<T,
705  execution::mapping_t>::is_valid
706  >::type>
707 {
708  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
709  ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
710 
711  typedef typename traits::query_static_constexpr_member<T,
712  execution::mapping_t>::result_type result_type;
713 
714  static ASIO_CONSTEXPR result_type value()
715  {
717  execution::mapping_t>::value();
718  }
719 };
720 
721 template <typename T>
722 struct static_query<T, execution::mapping_t,
723  typename enable_if<
724  !traits::query_static_constexpr_member<T, execution::mapping_t>::is_valid
725  && !traits::query_member<T, execution::mapping_t>::is_valid
726  && traits::static_query<T, execution::mapping_t::thread_t>::is_valid
727  >::type>
728 {
729  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
730  ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
731 
732  typedef typename traits::static_query<T,
733  execution::mapping_t::thread_t>::result_type result_type;
734 
735  static ASIO_CONSTEXPR result_type value()
736  {
738  }
739 };
740 
741 template <typename T>
742 struct static_query<T, execution::mapping_t,
743  typename enable_if<
744  !traits::query_static_constexpr_member<T, execution::mapping_t>::is_valid
745  && !traits::query_member<T, execution::mapping_t>::is_valid
746  && !traits::static_query<T, execution::mapping_t::thread_t>::is_valid
747  && traits::static_query<T, execution::mapping_t::new_thread_t>::is_valid
748  >::type>
749 {
750  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
751  ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
752 
753  typedef typename traits::static_query<T,
754  execution::mapping_t::new_thread_t>::result_type result_type;
755 
756  static ASIO_CONSTEXPR result_type value()
757  {
759  }
760 };
761 
762 template <typename T>
763 struct static_query<T, execution::mapping_t,
764  typename enable_if<
765  !traits::query_static_constexpr_member<T, execution::mapping_t>::is_valid
766  && !traits::query_member<T, execution::mapping_t>::is_valid
767  && !traits::static_query<T, execution::mapping_t::thread_t>::is_valid
768  && !traits::static_query<T, execution::mapping_t::new_thread_t>::is_valid
769  && traits::static_query<T, execution::mapping_t::other_t>::is_valid
770  >::type>
771 {
772  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
773  ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
774 
775  typedef typename traits::static_query<T,
776  execution::mapping_t::other_t>::result_type result_type;
777 
778  static ASIO_CONSTEXPR result_type value()
779  {
781  }
782 };
783 
784 template <typename T>
785 struct static_query<T, execution::mapping_t::thread_t,
786  typename enable_if<
787  traits::query_static_constexpr_member<T,
788  execution::mapping_t::thread_t>::is_valid
789  >::type>
790 {
791  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
792  ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
793 
794  typedef typename traits::query_static_constexpr_member<T,
795  execution::mapping_t::thread_t>::result_type result_type;
796 
797  static ASIO_CONSTEXPR result_type value()
798  {
801  }
802 };
803 
804 template <typename T>
805 struct static_query<T, execution::mapping_t::thread_t,
806  typename enable_if<
807  !traits::query_static_constexpr_member<T,
808  execution::mapping_t::thread_t>::is_valid
809  && !traits::query_member<T, execution::mapping_t::thread_t>::is_valid
810  && !traits::query_free<T, execution::mapping_t::thread_t>::is_valid
811  && !can_query<T, execution::mapping_t::new_thread_t>::value
812  && !can_query<T, execution::mapping_t::other_t>::value
813  >::type>
814 {
815  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
816  ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
817 
819 
820  static ASIO_CONSTEXPR result_type value()
821  {
822  return result_type();
823  }
824 };
825 
826 template <typename T>
827 struct static_query<T, execution::mapping_t::new_thread_t,
828  typename enable_if<
829  traits::query_static_constexpr_member<T,
830  execution::mapping_t::new_thread_t>::is_valid
831  >::type>
832 {
833  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
834  ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
835 
836  typedef typename traits::query_static_constexpr_member<T,
837  execution::mapping_t::new_thread_t>::result_type result_type;
838 
839  static ASIO_CONSTEXPR result_type value()
840  {
843  }
844 };
845 
846 template <typename T>
847 struct static_query<T, execution::mapping_t::other_t,
848  typename enable_if<
849  traits::query_static_constexpr_member<T,
850  execution::mapping_t::other_t>::is_valid
851  >::type>
852 {
853  ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
854  ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
855 
856  typedef typename traits::query_static_constexpr_member<T,
857  execution::mapping_t::other_t>::result_type result_type;
858 
859  static ASIO_CONSTEXPR result_type value()
860  {
863  }
864 };
865 
866 #endif // !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
867  // || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
868 
869 #if !defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
870 
871 template <typename T>
872 struct static_require<T, execution::mapping_t::thread_t,
873  typename enable_if<
874  static_query<T, execution::mapping_t::thread_t>::is_valid
875  >::type>
876 {
877  ASIO_STATIC_CONSTEXPR(bool, is_valid =
878  (is_same<typename static_query<T,
879  execution::mapping_t::thread_t>::result_type,
881 };
882 
883 template <typename T>
884 struct static_require<T, execution::mapping_t::new_thread_t,
885  typename enable_if<
886  static_query<T, execution::mapping_t::new_thread_t>::is_valid
887  >::type>
888 {
889  ASIO_STATIC_CONSTEXPR(bool, is_valid =
890  (is_same<typename static_query<T,
893 };
894 
895 template <typename T>
896 struct static_require<T, execution::mapping_t::other_t,
897  typename enable_if<
898  static_query<T, execution::mapping_t::other_t>::is_valid
899  >::type>
900 {
901  ASIO_STATIC_CONSTEXPR(bool, is_valid =
902  (is_same<typename static_query<T,
903  execution::mapping_t::other_t>::result_type,
905 };
906 
907 #endif // !defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
908 
909 } // namespace traits
910 
911 #endif // defined(GENERATING_DOCUMENTATION)
912 
913 } // namespace asio
914 
915 #include "asio/detail/pop_options.hpp"
916 
917 #endif // ASIO_EXECUTION_MAPPING_HPP
Definition: static_require.hpp:37
Definition: any_executor.hpp:249
Definition: query.hpp:269
The is_scheduler trait detects whether a type T satisfies the execution::scheduler concept...
Definition: scheduler.hpp:48
The is_sender trait detects whether a type T satisfies the execution::sender concept.
Definition: sender.hpp:183
Definition: query_member.hpp:38
Definition: static_query.hpp:42
Definition: chrono.h:284
Definition: type_traits.hpp:97
Definition: mapping.hpp:192
Definition: query.hpp:253
A simple abstraction for starting threads.
Definition: thread.hpp:48
Definition: query_free.hpp:35
Definition: query_free.hpp:38
Definition: query_static_constexpr_member.hpp:42
Definition: any_executor.hpp:256
Definition: handler_work.hpp:37
Definition: is_applicable_property.hpp:46
Definition: any_io_executor.hpp:28
The is_executor trait detects whether a type T satisfies the execution::executor concept.
Definition: executor.hpp:109