]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/traits/start_free.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / traits / start_free.hpp
1 //
2 // traits/start_free.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_TRAITS_START_FREE_HPP
12 #define BOOST_ASIO_TRAITS_START_FREE_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
21 #if defined(BOOST_ASIO_HAS_DECLTYPE) \
22 && defined(BOOST_ASIO_HAS_NOEXCEPT) \
23 && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
24 # define BOOST_ASIO_HAS_DEDUCED_START_FREE_TRAIT 1
25 #endif // defined(BOOST_ASIO_HAS_DECLTYPE)
26 // && defined(BOOST_ASIO_HAS_NOEXCEPT)
27 // && defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
28
29 #include <boost/asio/detail/push_options.hpp>
30
31 namespace boost {
32 namespace asio {
33 namespace traits {
34
35 template <typename T, typename = void>
36 struct start_free_default;
37
38 template <typename T, typename = void>
39 struct start_free;
40
41 } // namespace traits
42 namespace detail {
43
44 struct no_start_free
45 {
46 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
47 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
48 };
49
50 #if defined(BOOST_ASIO_HAS_DEDUCED_START_FREE_TRAIT)
51
52 template <typename T, typename = void>
53 struct start_free_trait : no_start_free
54 {
55 };
56
57 template <typename T>
58 struct start_free_trait<T,
59 typename void_type<
60 decltype(start(declval<T>()))
61 >::type>
62 {
63 BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
64
65 using result_type = decltype(start(declval<T>()));
66
67 BOOST_ASIO_STATIC_CONSTEXPR(bool,
68 is_noexcept = noexcept(start(declval<T>())));
69 };
70
71 #else // defined(BOOST_ASIO_HAS_DEDUCED_START_FREE_TRAIT)
72
73 template <typename T, typename = void>
74 struct start_free_trait :
75 conditional<
76 is_same<T, typename remove_reference<T>::type>::value,
77 typename conditional<
78 is_same<T, typename add_const<T>::type>::value,
79 no_start_free,
80 traits::start_free<typename add_const<T>::type>
81 >::type,
82 traits::start_free<typename remove_reference<T>::type>
83 >::type
84 {
85 };
86
87 #endif // defined(BOOST_ASIO_HAS_DEDUCED_START_FREE_TRAIT)
88
89 } // namespace detail
90 namespace traits {
91
92 template <typename T, typename>
93 struct start_free_default :
94 detail::start_free_trait<T>
95 {
96 };
97
98 template <typename T, typename>
99 struct start_free :
100 start_free_default<T>
101 {
102 };
103
104 } // namespace traits
105 } // namespace asio
106 } // namespace boost
107
108 #include <boost/asio/detail/pop_options.hpp>
109
110 #endif // BOOST_ASIO_TRAITS_START_FREE_HPP