Clementine
type_traits.hpp
1 //
2 // detail/type_traits.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_DETAIL_TYPE_TRAITS_HPP
12 #define ASIO_DETAIL_TYPE_TRAITS_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 
20 #if defined(ASIO_HAS_STD_TYPE_TRAITS)
21 # include <type_traits>
22 #else // defined(ASIO_HAS_STD_TYPE_TRAITS)
23 # include <boost/type_traits/add_const.hpp>
24 # include <boost/type_traits/add_lvalue_reference.hpp>
25 # include <boost/type_traits/aligned_storage.hpp>
26 # include <boost/type_traits/alignment_of.hpp>
27 # include <boost/type_traits/conditional.hpp>
28 # include <boost/type_traits/decay.hpp>
29 # include <boost/type_traits/has_nothrow_copy.hpp>
30 # include <boost/type_traits/has_nothrow_destructor.hpp>
31 # include <boost/type_traits/integral_constant.hpp>
32 # include <boost/type_traits/is_base_of.hpp>
33 # include <boost/type_traits/is_class.hpp>
34 # include <boost/type_traits/is_const.hpp>
35 # include <boost/type_traits/is_convertible.hpp>
36 # include <boost/type_traits/is_constructible.hpp>
37 # include <boost/type_traits/is_copy_constructible.hpp>
38 # include <boost/type_traits/is_destructible.hpp>
39 # include <boost/type_traits/is_function.hpp>
40 # include <boost/type_traits/is_object.hpp>
41 # include <boost/type_traits/is_same.hpp>
42 # include <boost/type_traits/remove_cv.hpp>
43 # include <boost/type_traits/remove_pointer.hpp>
44 # include <boost/type_traits/remove_reference.hpp>
45 # include <boost/utility/declval.hpp>
46 # include <boost/utility/enable_if.hpp>
47 # include <boost/utility/result_of.hpp>
48 #endif // defined(ASIO_HAS_STD_TYPE_TRAITS)
49 
50 namespace asio {
51 
52 #if defined(ASIO_HAS_STD_TYPE_TRAITS)
53 using std::add_const;
54 using std::add_lvalue_reference;
55 using std::aligned_storage;
56 using std::alignment_of;
57 using std::conditional;
58 using std::decay;
59 using std::declval;
60 using std::enable_if;
61 using std::false_type;
62 using std::integral_constant;
63 using std::is_base_of;
64 using std::is_class;
65 using std::is_const;
66 using std::is_constructible;
67 using std::is_convertible;
68 using std::is_copy_constructible;
69 using std::is_destructible;
70 using std::is_function;
71 using std::is_move_constructible;
72 using std::is_nothrow_copy_constructible;
73 using std::is_nothrow_destructible;
74 using std::is_object;
75 using std::is_reference;
76 using std::is_same;
77 using std::is_scalar;
78 using std::remove_cv;
79 template <typename T>
80 struct remove_cvref : remove_cv<typename std::remove_reference<T>::type> {};
81 using std::remove_pointer;
82 using std::remove_reference;
83 #if defined(ASIO_HAS_STD_INVOKE_RESULT)
84 template <typename> struct result_of;
85 template <typename F, typename... Args>
86 struct result_of<F(Args...)> : std::invoke_result<F, Args...> {};
87 #else // defined(ASIO_HAS_STD_INVOKE_RESULT)
88 using std::result_of;
89 #endif // defined(ASIO_HAS_STD_INVOKE_RESULT)
90 using std::true_type;
91 #else // defined(ASIO_HAS_STD_TYPE_TRAITS)
92 using boost::add_const;
93 using boost::add_lvalue_reference;
94 using boost::aligned_storage;
95 using boost::alignment_of;
96 template <bool Condition, typename Type = void>
97 struct enable_if : boost::enable_if_c<Condition, Type> {};
98 using boost::conditional;
99 using boost::decay;
100 using boost::declval;
101 using boost::false_type;
102 using boost::integral_constant;
103 using boost::is_base_of;
104 using boost::is_class;
105 using boost::is_const;
106 using boost::is_constructible;
107 using boost::is_convertible;
108 using boost::is_copy_constructible;
109 using boost::is_destructible;
110 using boost::is_function;
111 #if defined(ASIO_HAS_MOVE)
112 template <typename T>
113 struct is_move_constructible : false_type {};
114 #else // defined(ASIO_HAS_MOVE)
115 template <typename T>
116 struct is_move_constructible : is_copy_constructible<T> {};
117 #endif // defined(ASIO_HAS_MOVE)
118 template <typename T>
119 struct is_nothrow_copy_constructible : boost::has_nothrow_copy<T> {};
120 template <typename T>
121 struct is_nothrow_destructible : boost::has_nothrow_destructor<T> {};
122 using boost::is_object;
123 using boost::is_reference;
124 using boost::is_same;
125 using boost::is_scalar;
126 using boost::remove_cv;
127 template <typename T>
128 struct remove_cvref : remove_cv<typename boost::remove_reference<T>::type> {};
129 using boost::remove_pointer;
130 using boost::remove_reference;
131 using boost::result_of;
132 using boost::true_type;
133 #endif // defined(ASIO_HAS_STD_TYPE_TRAITS)
134 
135 template <typename> struct void_type { typedef void type; };
136 
137 #if defined(ASIO_HAS_VARIADIC_TEMPLATES)
138 
139 template <typename...> struct conjunction : true_type {};
140 template <typename T> struct conjunction<T> : T {};
141 template <typename Head, typename... Tail> struct conjunction<Head, Tail...> :
142  conditional<Head::value, conjunction<Tail...>, Head>::type {};
143 
144 #endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
145 
146 } // namespace asio
147 
148 #endif // ASIO_DETAIL_TYPE_TRAITS_HPP
Definition: type_traits.hpp:121
Definition: type_traits.hpp:135
Definition: type_traits.hpp:119
Definition: type_traits.hpp:97
Definition: type_traits.hpp:116
Definition: type_traits.hpp:128
Definition: any_io_executor.hpp:28