]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/execution/scheduler.hpp
9856d0e9cdd6bad79cadfc5d2133c16d971dcbbd
[ceph.git] / ceph / src / boost / boost / asio / execution / scheduler.hpp
1 //
2 // execution/scheduler.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2022 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_SCHEDULER_HPP
12 #define BOOST_ASIO_EXECUTION_SCHEDULER_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/schedule.hpp>
21 #include <boost/asio/traits/equality_comparable.hpp>
22
23 #include <boost/asio/detail/push_options.hpp>
24
25 namespace boost {
26 namespace asio {
27 namespace execution {
28 namespace detail {
29
30 template <typename T>
31 struct is_scheduler_base :
32 integral_constant<bool,
33 is_copy_constructible<typename remove_cvref<T>::type>::value
34 && traits::equality_comparable<typename remove_cvref<T>::type>::is_valid
35 >
36 {
37 };
38
39 } // namespace detail
40
41 /// The is_scheduler trait detects whether a type T satisfies the
42 /// execution::scheduler concept.
43 /**
44 * Class template @c is_scheduler is a type trait that is derived from @c
45 * true_type if the type @c T meets the concept definition for a scheduler for
46 * error type @c E, otherwise @c false_type.
47 */
48 template <typename T>
49 struct is_scheduler :
50 #if defined(GENERATING_DOCUMENTATION)
51 integral_constant<bool, automatically_determined>
52 #else // defined(GENERATING_DOCUMENTATION)
53 conditional<
54 can_schedule<T>::value,
55 detail::is_scheduler_base<T>,
56 false_type
57 >::type
58 #endif // defined(GENERATING_DOCUMENTATION)
59 {
60 };
61
62 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
63
64 template <typename T>
65 BOOST_ASIO_CONSTEXPR const bool is_scheduler_v = is_scheduler<T>::value;
66
67 #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
68
69 #if defined(BOOST_ASIO_HAS_CONCEPTS)
70
71 template <typename T>
72 BOOST_ASIO_CONCEPT scheduler = is_scheduler<T>::value;
73
74 #define BOOST_ASIO_EXECUTION_SCHEDULER ::boost::asio::execution::scheduler
75
76 #else // defined(BOOST_ASIO_HAS_CONCEPTS)
77
78 #define BOOST_ASIO_EXECUTION_SCHEDULER typename
79
80 #endif // defined(BOOST_ASIO_HAS_CONCEPTS)
81
82 } // namespace execution
83 } // namespace asio
84 } // namespace boost
85
86 #include <boost/asio/detail/pop_options.hpp>
87
88 #endif // BOOST_ASIO_EXECUTION_SCHEDULER_HPP