1 // 2 // execution/operation_state.hpp 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2021 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_OPERATION_STATE_HPP 12 #define BOOST_ASIO_EXECUTION_OPERATION_STATE_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/start.hpp> 21 22 #if defined(BOOST_ASIO_HAS_DEDUCED_START_FREE_TRAIT) \ 23 && defined(BOOST_ASIO_HAS_DEDUCED_START_MEMBER_TRAIT) 24 # define BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_OPERATION_STATE_TRAIT 1 25 #endif // defined(BOOST_ASIO_HAS_DEDUCED_START_FREE_TRAIT) 26 // && defined(BOOST_ASIO_HAS_DEDUCED_START_MEMBER_TRAIT) 27 28 #include <boost/asio/detail/push_options.hpp> 29 30 namespace boost { 31 namespace asio { 32 namespace execution { 33 namespace detail { 34 35 template <typename T> 36 struct is_operation_state_base : 37 integral_constant<bool, 38 is_destructible<T>::value 39 && is_object<T>::value 40 > 41 { 42 }; 43 44 } // namespace detail 45 46 /// The is_operation_state trait detects whether a type T satisfies the 47 /// execution::operation_state concept. 48 /** 49 * Class template @c is_operation_state is a type trait that is derived from 50 * @c true_type if the type @c T meets the concept definition for an 51 * @c operation_state, otherwise @c false_type. 52 */ 53 template <typename T> 54 struct is_operation_state : 55 #if defined(GENERATING_DOCUMENTATION) 56 integral_constant<bool, automatically_determined> 57 #else // defined(GENERATING_DOCUMENTATION) 58 conditional< 59 can_start<typename add_lvalue_reference<T>::type>::value 60 && is_nothrow_start<typename add_lvalue_reference<T>::type>::value, 61 detail::is_operation_state_base<T>, 62 false_type 63 >::type 64 #endif // defined(GENERATING_DOCUMENTATION) 65 { 66 }; 67 68 #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) 69 70 template <typename T> 71 BOOST_ASIO_CONSTEXPR const bool is_operation_state_v = 72 is_operation_state<T>::value; 73 74 #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) 75 76 #if defined(BOOST_ASIO_HAS_CONCEPTS) 77 78 template <typename T> 79 BOOST_ASIO_CONCEPT operation_state = is_operation_state<T>::value; 80 81 #define BOOST_ASIO_EXECUTION_OPERATION_STATE \ 82 ::boost::asio::execution::operation_state 83 84 #else // defined(BOOST_ASIO_HAS_CONCEPTS) 85 86 #define BOOST_ASIO_EXECUTION_OPERATION_STATE typename 87 88 #endif // defined(BOOST_ASIO_HAS_CONCEPTS) 89 90 } // namespace execution 91 } // namespace asio 92 } // namespace boost 93 94 #include <boost/asio/detail/pop_options.hpp> 95 96 #endif // BOOST_ASIO_EXECUTION_OPERATION_STATE_HPP 97