1//
2// detail/type_traits.hpp
3// ~~~~~~~~~~~~~~~~~~~~~~
4//
5// Copyright (c) 2003-2024 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_DETAIL_TYPE_TRAITS_HPP
12#define BOOST_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 <boost/asio/detail/config.hpp>
19#include <type_traits>
20
21namespace boost {
22namespace asio {
23
24using std::add_const;
25
26template <typename T>
27using add_const_t = typename std::add_const<T>::type;
28
29using std::add_lvalue_reference;
30
31template <typename T>
32using add_lvalue_reference_t = typename std::add_lvalue_reference<T>::type;
33
34template <std::size_t N, std::size_t A>
35struct aligned_storage
36{
37 struct type
38 {
39 alignas(A) unsigned char data[N];
40 };
41};
42
43template <std::size_t N, std::size_t A>
44using aligned_storage_t = typename aligned_storage<N, A>::type;
45
46using std::alignment_of;
47
48using std::conditional;
49
50template <bool C, typename T, typename U>
51using conditional_t = typename std::conditional<C, T, U>::type;
52
53using std::decay;
54
55template <typename T>
56using decay_t = typename std::decay<T>::type;
57
58using std::declval;
59
60using std::enable_if;
61
62template <bool C, typename T = void>
63using enable_if_t = typename std::enable_if<C, T>::type;
64
65using std::false_type;
66
67using std::integral_constant;
68
69using std::is_base_of;
70
71using std::is_class;
72
73using std::is_const;
74
75using std::is_constructible;
76
77using std::is_convertible;
78
79using std::is_copy_constructible;
80
81using std::is_destructible;
82
83using std::is_function;
84
85using std::is_move_constructible;
86
87using std::is_nothrow_copy_constructible;
88
89using std::is_nothrow_destructible;
90
91using std::is_object;
92
93using std::is_pointer;
94
95using std::is_reference;
96
97using std::is_same;
98
99using std::is_scalar;
100
101using std::remove_cv;
102
103template <typename T>
104using remove_cv_t = typename std::remove_cv<T>::type;
105
106template <typename T>
107struct remove_cvref :
108 std::remove_cv<typename std::remove_reference<T>::type> {};
109
110template <typename T>
111using remove_cvref_t = typename remove_cvref<T>::type;
112
113using std::remove_pointer;
114
115template <typename T>
116using remove_pointer_t = typename std::remove_pointer<T>::type;
117
118using std::remove_reference;
119
120template <typename T>
121using remove_reference_t = typename std::remove_reference<T>::type;
122
123#if defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
124
125template <typename> struct result_of;
126
127template <typename F, typename... Args>
128struct result_of<F(Args...)> : std::invoke_result<F, Args...> {};
129
130template <typename T>
131using result_of_t = typename result_of<T>::type;
132
133#else // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
134
135using std::result_of;
136
137template <typename T>
138using result_of_t = typename std::result_of<T>::type;
139
140#endif // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
141
142using std::true_type;
143
144template <typename> struct void_type
145{
146 typedef void type;
147};
148
149template <typename T>
150using void_t = typename void_type<T>::type;
151
152template <typename...> struct conjunction : true_type {};
153
154template <typename T> struct conjunction<T> : T {};
155
156template <typename Head, typename... Tail>
157struct conjunction<Head, Tail...> :
158 conditional_t<Head::value, conjunction<Tail...>, Head> {};
159
160struct defaulted_constraint
161{
162 constexpr defaulted_constraint() {}
163};
164
165template <bool Condition, typename Type = int>
166struct constraint : std::enable_if<Condition, Type> {};
167
168template <bool Condition, typename Type = int>
169using constraint_t = typename constraint<Condition, Type>::type;
170
171template <typename T>
172struct type_identity { typedef T type; };
173
174template <typename T>
175using type_identity_t = typename type_identity<T>::type;
176
177} // namespace asio
178} // namespace boost
179
180#endif // BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP
181

source code of boost/libs/asio/include/boost/asio/detail/type_traits.hpp