]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/libc++/include/experimental/type_traits
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / libc++ / include / experimental / type_traits
1 // -*- C++ -*-
2 //===-------------------------- type_traits -------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
12 #define _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
13
14 /**
15     experimental/type_traits synopsis
16
17 // C++1y
18 #include <type_traits>
19
20 namespace std {
21 namespace experimental {
22 inline namespace fundamentals_v1 {
23
24   // See C++14 20.10.4.1, primary type categories
25   template <class T> constexpr bool is_void_v
26     = is_void<T>::value;
27   template <class T> constexpr bool is_null_pointer_v
28     = is_null_pointer<T>::value;
29   template <class T> constexpr bool is_integral_v
30     = is_integral<T>::value;
31   template <class T> constexpr bool is_floating_point_v
32     = is_floating_point<T>::value;
33   template <class T> constexpr bool is_array_v
34     = is_array<T>::value;
35   template <class T> constexpr bool is_pointer_v
36     = is_pointer<T>::value;
37   template <class T> constexpr bool is_lvalue_reference_v
38     = is_lvalue_reference<T>::value;
39   template <class T> constexpr bool is_rvalue_reference_v
40     = is_rvalue_reference<T>::value;
41   template <class T> constexpr bool is_member_object_pointer_v
42     = is_member_object_pointer<T>::value;
43   template <class T> constexpr bool is_member_function_pointer_v
44     = is_member_function_pointer<T>::value;
45   template <class T> constexpr bool is_enum_v
46     = is_enum<T>::value;
47   template <class T> constexpr bool is_union_v
48     = is_union<T>::value;
49   template <class T> constexpr bool is_class_v
50     = is_class<T>::value;
51   template <class T> constexpr bool is_function_v
52     = is_function<T>::value;
53
54   // See C++14 20.10.4.2, composite type categories
55   template <class T> constexpr bool is_reference_v
56     = is_reference<T>::value;
57   template <class T> constexpr bool is_arithmetic_v
58     = is_arithmetic<T>::value;
59   template <class T> constexpr bool is_fundamental_v
60     = is_fundamental<T>::value;
61   template <class T> constexpr bool is_object_v
62     = is_object<T>::value;
63   template <class T> constexpr bool is_scalar_v
64     = is_scalar<T>::value;
65   template <class T> constexpr bool is_compound_v
66     = is_compound<T>::value;
67   template <class T> constexpr bool is_member_pointer_v
68     = is_member_pointer<T>::value;
69
70   // See C++14 20.10.4.3, type properties
71   template <class T> constexpr bool is_const_v
72     = is_const<T>::value;
73   template <class T> constexpr bool is_volatile_v
74     = is_volatile<T>::value;
75   template <class T> constexpr bool is_trivial_v
76     = is_trivial<T>::value;
77   template <class T> constexpr bool is_trivially_copyable_v
78     = is_trivially_copyable<T>::value;
79   template <class T> constexpr bool is_standard_layout_v
80     = is_standard_layout<T>::value;
81   template <class T> constexpr bool is_pod_v
82     = is_pod<T>::value;
83   template <class T> constexpr bool is_literal_type_v
84     = is_literal_type<T>::value;
85   template <class T> constexpr bool is_empty_v
86     = is_empty<T>::value;
87   template <class T> constexpr bool is_polymorphic_v
88     = is_polymorphic<T>::value;
89   template <class T> constexpr bool is_abstract_v
90     = is_abstract<T>::value;
91   template <class T> constexpr bool is_final_v
92     = is_final<T>::value;
93   template <class T> constexpr bool is_signed_v
94     = is_signed<T>::value;
95   template <class T> constexpr bool is_unsigned_v
96     = is_unsigned<T>::value;
97   template <class T, class... Args> constexpr bool is_constructible_v
98     = is_constructible<T, Args...>::value;
99   template <class T> constexpr bool is_default_constructible_v
100     = is_default_constructible<T>::value;
101   template <class T> constexpr bool is_copy_constructible_v
102     = is_copy_constructible<T>::value;
103   template <class T> constexpr bool is_move_constructible_v
104     = is_move_constructible<T>::value;
105   template <class T, class U> constexpr bool is_assignable_v
106     = is_assignable<T, U>::value;
107   template <class T> constexpr bool is_copy_assignable_v
108     = is_copy_assignable<T>::value;
109   template <class T> constexpr bool is_move_assignable_v
110     = is_move_assignable<T>::value;
111   template <class T> constexpr bool is_destructible_v
112     = is_destructible<T>::value;
113   template <class T, class... Args> constexpr bool is_trivially_constructible_v
114     = is_trivially_constructible<T, Args...>::value;
115   template <class T> constexpr bool is_trivially_default_constructible_v
116     = is_trivially_default_constructible<T>::value;
117   template <class T> constexpr bool is_trivially_copy_constructible_v
118     = is_trivially_copy_constructible<T>::value;
119   template <class T> constexpr bool is_trivially_move_constructible_v
120     = is_trivially_move_constructible<T>::value;
121   template <class T, class U> constexpr bool is_trivially_assignable_v
122     = is_trivially_assignable<T, U>::value;
123   template <class T> constexpr bool is_trivially_copy_assignable_v
124     = is_trivially_copy_assignable<T>::value;
125   template <class T> constexpr bool is_trivially_move_assignable_v
126     = is_trivially_move_assignable<T>::value;
127   template <class T> constexpr bool is_trivially_destructible_v
128     = is_trivially_destructible<T>::value;
129   template <class T, class... Args> constexpr bool is_nothrow_constructible_v
130     = is_nothrow_constructible<T, Args...>::value;
131   template <class T> constexpr bool is_nothrow_default_constructible_v
132     = is_nothrow_default_constructible<T>::value;
133   template <class T> constexpr bool is_nothrow_copy_constructible_v
134     = is_nothrow_copy_constructible<T>::value;
135   template <class T> constexpr bool is_nothrow_move_constructible_v
136     = is_nothrow_move_constructible<T>::value;
137   template <class T, class U> constexpr bool is_nothrow_assignable_v
138     = is_nothrow_assignable<T, U>::value;
139   template <class T> constexpr bool is_nothrow_copy_assignable_v
140     = is_nothrow_copy_assignable<T>::value;
141   template <class T> constexpr bool is_nothrow_move_assignable_v
142     = is_nothrow_move_assignable<T>::value;
143   template <class T> constexpr bool is_nothrow_destructible_v
144     = is_nothrow_destructible<T>::value;
145   template <class T> constexpr bool has_virtual_destructor_v
146     = has_virtual_destructor<T>::value;
147
148   // See C++14 20.10.5, type property queries
149   template <class T> constexpr size_t alignment_of_v
150     = alignment_of<T>::value;
151   template <class T> constexpr size_t rank_v
152     = rank<T>::value;
153   template <class T, unsigned I = 0> constexpr size_t extent_v
154     = extent<T, I>::value;
155
156   // See C++14 20.10.6, type relations
157   template <class T, class U> constexpr bool is_same_v
158     = is_same<T, U>::value;
159   template <class Base, class Derived> constexpr bool is_base_of_v
160     = is_base_of<Base, Derived>::value;
161   template <class From, class To> constexpr bool is_convertible_v
162     = is_convertible<From, To>::value;
163
164   // 3.3.2, Other type transformations
165   template <class> class invocation_type; // not defined
166   template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>;
167   template <class> class raw_invocation_type; // not defined
168   template <class F, class... ArgTypes> class raw_invocation_type<F(ArgTypes...)>;
169
170   template <class T>
171     using invocation_type_t = typename invocation_type<T>::type;
172   template <class T>
173     using raw_invocation_type_t = typename raw_invocation_type<T>::type;
174
175 } // namespace fundamentals_v1
176 } // namespace experimental
177 } // namespace std
178
179  */
180
181 #include <experimental/__config>
182
183 #if _LIBCPP_STD_VER > 11
184
185 #include <type_traits>
186
187 _LIBCPP_BEGIN_NAMESPACE_LFTS
188
189 #if __has_feature(cxx_variable_templates)
190
191 // C++14 20.10.4.1, primary type categories
192
193 template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v
194     = is_void<_Tp>::value;
195
196 template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v
197     = is_null_pointer<_Tp>::value;
198
199 template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v
200     = is_integral<_Tp>::value;
201
202 template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v
203     = is_floating_point<_Tp>::value;
204
205 template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v
206     = is_array<_Tp>::value;
207
208 template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v
209     = is_pointer<_Tp>::value;
210
211 template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v
212     = is_lvalue_reference<_Tp>::value;
213
214 template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
215     = is_rvalue_reference<_Tp>::value;
216
217 template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
218     = is_member_object_pointer<_Tp>::value;
219
220 template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
221     = is_member_function_pointer<_Tp>::value;
222
223 template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v
224     = is_enum<_Tp>::value;
225
226 template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v
227     = is_union<_Tp>::value;
228
229 template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v
230     = is_class<_Tp>::value;
231
232 template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v
233     = is_function<_Tp>::value;
234
235 // C++14 20.10.4.2,  composite type categories
236
237 template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v
238     = is_reference<_Tp>::value;
239
240 template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v
241     = is_arithmetic<_Tp>::value;
242
243 template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v
244     = is_fundamental<_Tp>::value;
245
246 template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v
247     = is_object<_Tp>::value;
248
249 template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v
250     = is_scalar<_Tp>::value;
251
252 template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
253     = is_compound<_Tp>::value;
254
255 template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v
256     = is_member_pointer<_Tp>::value;
257
258 // C++14 20.10.4.3, type properties
259
260 template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v
261     = is_const<_Tp>::value;
262
263 template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v
264     = is_volatile<_Tp>::value;
265
266 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v
267     = is_trivial<_Tp>::value;
268
269 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
270     = is_trivially_copyable<_Tp>::value;
271
272 template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v
273     = is_standard_layout<_Tp>::value;
274
275 template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v
276     = is_pod<_Tp>::value;
277
278 template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v
279     = is_literal_type<_Tp>::value;
280
281 template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
282     = is_empty<_Tp>::value;
283
284 template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v
285     = is_polymorphic<_Tp>::value;
286
287 template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
288     = is_abstract<_Tp>::value;
289
290 template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
291     = is_final<_Tp>::value;
292
293 template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v
294     = is_signed<_Tp>::value;
295
296 template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v
297     = is_unsigned<_Tp>::value;
298
299 template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_constructible_v
300     = is_constructible<_Tp, _Ts...>::value;
301
302 template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v
303     = is_default_constructible<_Tp>::value;
304
305 template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v
306     = is_copy_constructible<_Tp>::value;
307
308 template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v
309     = is_move_constructible<_Tp>::value;
310
311 template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_assignable_v
312     = is_assignable<_Tp, _Up>::value;
313
314 template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v
315     = is_copy_assignable<_Tp>::value;
316
317 template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v
318     = is_move_assignable<_Tp>::value;
319
320 template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v
321     = is_destructible<_Tp>::value;
322
323 template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
324     = is_trivially_constructible<_Tp, _Ts...>::value;
325
326 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v
327     = is_trivially_default_constructible<_Tp>::value;
328
329 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
330     = is_trivially_copy_constructible<_Tp>::value;
331
332 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v
333     = is_trivially_move_constructible<_Tp>::value;
334
335 template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v
336     = is_trivially_assignable<_Tp, _Up>::value;
337
338 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
339     = is_trivially_copy_assignable<_Tp>::value;
340
341 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
342     = is_trivially_move_assignable<_Tp>::value;
343
344 template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
345     = is_trivially_destructible<_Tp>::value;
346
347 template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
348     = is_nothrow_constructible<_Tp, _Ts...>::value;
349
350 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v
351     = is_nothrow_default_constructible<_Tp>::value;
352
353 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
354     = is_nothrow_copy_constructible<_Tp>::value;
355
356 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
357     = is_nothrow_move_constructible<_Tp>::value;
358
359 template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v
360     = is_nothrow_assignable<_Tp, _Up>::value;
361
362 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
363     = is_nothrow_copy_assignable<_Tp>::value;
364
365 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
366     = is_nothrow_move_assignable<_Tp>::value;
367
368 template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
369     = is_nothrow_destructible<_Tp>::value;
370
371 template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v
372     = has_virtual_destructor<_Tp>::value;
373
374 // C++14 20.10.5, type properties queries
375
376 template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v
377     = alignment_of<_Tp>::value;
378
379 template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v
380     = rank<_Tp>::value;
381
382 template <class _Tp, unsigned _Id = 0> _LIBCPP_CONSTEXPR size_t extent_v
383     = extent<_Tp, _Id>::value;
384
385 // C++14 20.10.6, type relations
386
387 template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v
388     = is_same<_Tp, _Up>::value;
389
390 template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v
391     = is_base_of<_Tp, _Up>::value;
392
393 template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v
394     = is_convertible<_Tp, _Up>::value;
395
396 #endif /* __has_feature(cxx_variable_templates) */
397
398 // 3.3.2, Other type transformations
399 /*
400 template <class>
401 class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type;
402
403 template <class _Fn, class ..._Args>
404 class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type<_Fn(_Args...)>;
405
406 template <class>
407 class _LIBCPP_TYPE_VIS_ONLY invokation_type;
408
409 template <class _Fn, class ..._Args>
410 class _LIBCPP_TYPE_VIS_ONLY invokation_type<_Fn(_Args...)>;
411
412 template <class _Tp>
413 using invokation_type_t = typename invokation_type<_Tp>::type;
414
415 template <class _Tp>
416 using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
417 */
418
419 _LIBCPP_END_NAMESPACE_LFTS
420
421 #endif /* _LIBCPP_STD_VER > 11 */
422
423 #endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */