]>
Commit | Line | Data |
---|---|---|
c0ffa2ba | 1 | // C++11 <type_traits> -*- C++ -*- |
af13a7a6 | 2 | |
85ec4feb | 3 | // Copyright (C) 2007-2018 Free Software Foundation, Inc. |
af13a7a6 BK |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
748086b7 | 8 | // Free Software Foundation; either version 3, or (at your option) |
af13a7a6 BK |
9 | // any later version. |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
748086b7 JJ |
16 | // Under Section 7 of GPL version 3, you are granted additional |
17 | // permissions described in the GCC Runtime Library Exception, version | |
18 | // 3.1, as published by the Free Software Foundation. | |
19 | ||
20 | // You should have received a copy of the GNU General Public License and | |
21 | // a copy of the GCC Runtime Library Exception along with this program; | |
22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
23 | // <http://www.gnu.org/licenses/>. | |
af13a7a6 BK |
24 | |
25 | /** @file include/type_traits | |
26 | * This is a Standard C++ Library header. | |
27 | */ | |
28 | ||
4514bed6 BK |
29 | #ifndef _GLIBCXX_TYPE_TRAITS |
30 | #define _GLIBCXX_TYPE_TRAITS 1 | |
af13a7a6 BK |
31 | |
32 | #pragma GCC system_header | |
33 | ||
734f5023 | 34 | #if __cplusplus < 201103L |
ab65a4c7 | 35 | # include <bits/c++0x_warning.h> |
57317d2a | 36 | #else |
af13a7a6 | 37 | |
8fc81078 | 38 | #include <bits/c++config.h> |
e133ace8 | 39 | |
c0eef1c8 JW |
40 | #ifdef _GLIBCXX_USE_C99_STDINT_TR1 |
41 | # if defined (__UINT_LEAST16_TYPE__) && defined(__UINT_LEAST32_TYPE__) | |
21e2806a JW |
42 | namespace std |
43 | { | |
c0eef1c8 JW |
44 | typedef __UINT_LEAST16_TYPE__ uint_least16_t; |
45 | typedef __UINT_LEAST32_TYPE__ uint_least32_t; | |
21e2806a | 46 | } |
c0eef1c8 JW |
47 | # else |
48 | # include <cstdint> | |
49 | # endif | |
50 | #endif | |
51 | ||
21e2806a JW |
52 | namespace std _GLIBCXX_VISIBILITY(default) |
53 | { | |
54 | _GLIBCXX_BEGIN_NAMESPACE_VERSION | |
55 | ||
8e32aa11 | 56 | /** |
c0ffa2ba | 57 | * @defgroup metaprogramming Metaprogramming |
13901e4b JW |
58 | * @ingroup utilities |
59 | * | |
60 | * Template utilities for compile-time introspection and modification, | |
61 | * including type classification traits, type property inspection traits | |
62 | * and type transformation traits. | |
63 | * | |
5b9daa7e BK |
64 | * @{ |
65 | */ | |
ac65b7d2 DK |
66 | |
67 | /// integral_constant | |
68 | template<typename _Tp, _Tp __v> | |
69 | struct integral_constant | |
70 | { | |
71 | static constexpr _Tp value = __v; | |
72 | typedef _Tp value_type; | |
73 | typedef integral_constant<_Tp, __v> type; | |
352111c5 | 74 | constexpr operator value_type() const noexcept { return value; } |
db113eda | 75 | #if __cplusplus > 201103L |
a15f7cb8 ESR |
76 | |
77 | #define __cpp_lib_integral_constant_callable 201304 | |
78 | ||
352111c5 | 79 | constexpr value_type operator()() const noexcept { return value; } |
db113eda | 80 | #endif |
ac65b7d2 | 81 | }; |
33ac58d5 | 82 | |
c0ffa2ba BK |
83 | template<typename _Tp, _Tp __v> |
84 | constexpr _Tp integral_constant<_Tp, __v>::value; | |
85 | ||
13901e4b | 86 | /// The type used as a compile-time boolean with true value. |
ac65b7d2 DK |
87 | typedef integral_constant<bool, true> true_type; |
88 | ||
13901e4b | 89 | /// The type used as a compile-time boolean with false value. |
ac65b7d2 DK |
90 | typedef integral_constant<bool, false> false_type; |
91 | ||
f6b640be JW |
92 | template<bool __v> |
93 | using __bool_constant = integral_constant<bool, __v>; | |
94 | ||
46ba1281 | 95 | #if __cplusplus > 201402L |
f9badf71 | 96 | # define __cpp_lib_bool_constant 201505 |
46ba1281 JW |
97 | template<bool __v> |
98 | using bool_constant = integral_constant<bool, __v>; | |
99 | #endif | |
100 | ||
123c516a | 101 | // Meta programming helper types. |
53dc5044 | 102 | |
123c516a PC |
103 | template<bool, typename, typename> |
104 | struct conditional; | |
53dc5044 | 105 | |
dd7b175e | 106 | template<typename...> |
123c516a PC |
107 | struct __or_; |
108 | ||
ac65b7d2 DK |
109 | template<> |
110 | struct __or_<> | |
111 | : public false_type | |
112 | { }; | |
113 | ||
dd7b175e PC |
114 | template<typename _B1> |
115 | struct __or_<_B1> | |
116 | : public _B1 | |
117 | { }; | |
118 | ||
123c516a PC |
119 | template<typename _B1, typename _B2> |
120 | struct __or_<_B1, _B2> | |
121 | : public conditional<_B1::value, _B1, _B2>::type | |
122 | { }; | |
123 | ||
124 | template<typename _B1, typename _B2, typename _B3, typename... _Bn> | |
125 | struct __or_<_B1, _B2, _B3, _Bn...> | |
126 | : public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type | |
127 | { }; | |
53dc5044 | 128 | |
dd7b175e | 129 | template<typename...> |
123c516a | 130 | struct __and_; |
53dc5044 | 131 | |
ac65b7d2 DK |
132 | template<> |
133 | struct __and_<> | |
134 | : public true_type | |
135 | { }; | |
136 | ||
dd7b175e PC |
137 | template<typename _B1> |
138 | struct __and_<_B1> | |
139 | : public _B1 | |
140 | { }; | |
141 | ||
123c516a PC |
142 | template<typename _B1, typename _B2> |
143 | struct __and_<_B1, _B2> | |
144 | : public conditional<_B1::value, _B2, _B1>::type | |
145 | { }; | |
146 | ||
147 | template<typename _B1, typename _B2, typename _B3, typename... _Bn> | |
148 | struct __and_<_B1, _B2, _B3, _Bn...> | |
149 | : public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type | |
150 | { }; | |
151 | ||
152 | template<typename _Pp> | |
153 | struct __not_ | |
4b9840f2 | 154 | : public __bool_constant<!bool(_Pp::value)> |
123c516a PC |
155 | { }; |
156 | ||
4b9840f2 | 157 | #if __cplusplus >= 201703L |
c3a6648b | 158 | |
068c8ac1 | 159 | #define __cpp_lib_logical_traits 201510 |
c3a6648b VV |
160 | |
161 | template<typename... _Bn> | |
162 | struct conjunction | |
163 | : __and_<_Bn...> | |
164 | { }; | |
165 | ||
166 | template<typename... _Bn> | |
167 | struct disjunction | |
168 | : __or_<_Bn...> | |
169 | { }; | |
170 | ||
171 | template<typename _Pp> | |
172 | struct negation | |
173 | : __not_<_Pp> | |
174 | { }; | |
137422c8 VV |
175 | |
176 | template<typename... _Bn> | |
4b9840f2 | 177 | inline constexpr bool conjunction_v = conjunction<_Bn...>::value; |
42183d03 | 178 | |
137422c8 | 179 | template<typename... _Bn> |
4b9840f2 | 180 | inline constexpr bool disjunction_v = disjunction<_Bn...>::value; |
42183d03 | 181 | |
137422c8 | 182 | template<typename _Pp> |
4b9840f2 | 183 | inline constexpr bool negation_v = negation<_Pp>::value; |
137422c8 | 184 | |
4b9840f2 | 185 | #endif // C++17 |
c3a6648b | 186 | |
b3618b71 DK |
187 | // For several sfinae-friendly trait implementations we transport both the |
188 | // result information (as the member type) and the failure information (no | |
189 | // member type). This is very similar to std::enable_if, but we cannot use | |
190 | // them, because we need to derive from them as an implementation detail. | |
191 | ||
192 | template<typename _Tp> | |
193 | struct __success_type | |
194 | { typedef _Tp type; }; | |
195 | ||
196 | struct __failure_type | |
197 | { }; | |
198 | ||
c0ffa2ba | 199 | // Primary type categories. |
123c516a | 200 | |
53dc5044 PC |
201 | template<typename> |
202 | struct remove_cv; | |
203 | ||
204 | template<typename> | |
205 | struct __is_void_helper | |
206 | : public false_type { }; | |
53dc5044 | 207 | |
123c516a PC |
208 | template<> |
209 | struct __is_void_helper<void> | |
210 | : public true_type { }; | |
53dc5044 PC |
211 | |
212 | /// is_void | |
213 | template<typename _Tp> | |
214 | struct is_void | |
82b12c4b | 215 | : public __is_void_helper<typename remove_cv<_Tp>::type>::type |
53dc5044 PC |
216 | { }; |
217 | ||
218 | template<typename> | |
219 | struct __is_integral_helper | |
220 | : public false_type { }; | |
123c516a PC |
221 | |
222 | template<> | |
223 | struct __is_integral_helper<bool> | |
224 | : public true_type { }; | |
33ac58d5 | 225 | |
123c516a PC |
226 | template<> |
227 | struct __is_integral_helper<char> | |
228 | : public true_type { }; | |
229 | ||
230 | template<> | |
231 | struct __is_integral_helper<signed char> | |
232 | : public true_type { }; | |
233 | ||
234 | template<> | |
235 | struct __is_integral_helper<unsigned char> | |
236 | : public true_type { }; | |
237 | ||
53dc5044 | 238 | #ifdef _GLIBCXX_USE_WCHAR_T |
123c516a PC |
239 | template<> |
240 | struct __is_integral_helper<wchar_t> | |
241 | : public true_type { }; | |
53dc5044 | 242 | #endif |
123c516a PC |
243 | |
244 | template<> | |
245 | struct __is_integral_helper<char16_t> | |
246 | : public true_type { }; | |
247 | ||
248 | template<> | |
249 | struct __is_integral_helper<char32_t> | |
250 | : public true_type { }; | |
251 | ||
252 | template<> | |
253 | struct __is_integral_helper<short> | |
254 | : public true_type { }; | |
255 | ||
256 | template<> | |
257 | struct __is_integral_helper<unsigned short> | |
258 | : public true_type { }; | |
259 | ||
260 | template<> | |
261 | struct __is_integral_helper<int> | |
262 | : public true_type { }; | |
263 | ||
264 | template<> | |
265 | struct __is_integral_helper<unsigned int> | |
266 | : public true_type { }; | |
267 | ||
268 | template<> | |
269 | struct __is_integral_helper<long> | |
270 | : public true_type { }; | |
271 | ||
272 | template<> | |
273 | struct __is_integral_helper<unsigned long> | |
274 | : public true_type { }; | |
275 | ||
276 | template<> | |
277 | struct __is_integral_helper<long long> | |
278 | : public true_type { }; | |
279 | ||
280 | template<> | |
281 | struct __is_integral_helper<unsigned long long> | |
282 | : public true_type { }; | |
53dc5044 | 283 | |
78a7c317 DD |
284 | // Conditionalizing on __STRICT_ANSI__ here will break any port that |
285 | // uses one of these types for size_t. | |
286 | #if defined(__GLIBCXX_TYPE_INT_N_0) | |
6d585f01 | 287 | template<> |
78a7c317 | 288 | struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0> |
6d585f01 PC |
289 | : public true_type { }; |
290 | ||
291 | template<> | |
78a7c317 DD |
292 | struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0> |
293 | : public true_type { }; | |
294 | #endif | |
295 | #if defined(__GLIBCXX_TYPE_INT_N_1) | |
296 | template<> | |
297 | struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1> | |
298 | : public true_type { }; | |
299 | ||
300 | template<> | |
301 | struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1> | |
302 | : public true_type { }; | |
303 | #endif | |
304 | #if defined(__GLIBCXX_TYPE_INT_N_2) | |
305 | template<> | |
306 | struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2> | |
307 | : public true_type { }; | |
308 | ||
309 | template<> | |
310 | struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2> | |
311 | : public true_type { }; | |
312 | #endif | |
313 | #if defined(__GLIBCXX_TYPE_INT_N_3) | |
314 | template<> | |
315 | struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3> | |
316 | : public true_type { }; | |
317 | ||
318 | template<> | |
319 | struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3> | |
6d585f01 PC |
320 | : public true_type { }; |
321 | #endif | |
322 | ||
53dc5044 PC |
323 | /// is_integral |
324 | template<typename _Tp> | |
325 | struct is_integral | |
82b12c4b | 326 | : public __is_integral_helper<typename remove_cv<_Tp>::type>::type |
53dc5044 PC |
327 | { }; |
328 | ||
329 | template<typename> | |
330 | struct __is_floating_point_helper | |
331 | : public false_type { }; | |
123c516a PC |
332 | |
333 | template<> | |
334 | struct __is_floating_point_helper<float> | |
335 | : public true_type { }; | |
336 | ||
337 | template<> | |
338 | struct __is_floating_point_helper<double> | |
339 | : public true_type { }; | |
340 | ||
341 | template<> | |
342 | struct __is_floating_point_helper<long double> | |
343 | : public true_type { }; | |
53dc5044 | 344 | |
6d585f01 PC |
345 | #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) |
346 | template<> | |
347 | struct __is_floating_point_helper<__float128> | |
348 | : public true_type { }; | |
349 | #endif | |
350 | ||
53dc5044 PC |
351 | /// is_floating_point |
352 | template<typename _Tp> | |
353 | struct is_floating_point | |
82b12c4b | 354 | : public __is_floating_point_helper<typename remove_cv<_Tp>::type>::type |
53dc5044 PC |
355 | { }; |
356 | ||
357 | /// is_array | |
358 | template<typename> | |
359 | struct is_array | |
360 | : public false_type { }; | |
361 | ||
362 | template<typename _Tp, std::size_t _Size> | |
363 | struct is_array<_Tp[_Size]> | |
364 | : public true_type { }; | |
365 | ||
366 | template<typename _Tp> | |
367 | struct is_array<_Tp[]> | |
368 | : public true_type { }; | |
369 | ||
370 | template<typename> | |
371 | struct __is_pointer_helper | |
372 | : public false_type { }; | |
123c516a PC |
373 | |
374 | template<typename _Tp> | |
375 | struct __is_pointer_helper<_Tp*> | |
376 | : public true_type { }; | |
53dc5044 PC |
377 | |
378 | /// is_pointer | |
379 | template<typename _Tp> | |
380 | struct is_pointer | |
82b12c4b | 381 | : public __is_pointer_helper<typename remove_cv<_Tp>::type>::type |
53dc5044 PC |
382 | { }; |
383 | ||
123c516a PC |
384 | /// is_lvalue_reference |
385 | template<typename> | |
386 | struct is_lvalue_reference | |
387 | : public false_type { }; | |
388 | ||
53dc5044 | 389 | template<typename _Tp> |
123c516a PC |
390 | struct is_lvalue_reference<_Tp&> |
391 | : public true_type { }; | |
392 | ||
393 | /// is_rvalue_reference | |
394 | template<typename> | |
395 | struct is_rvalue_reference | |
396 | : public false_type { }; | |
53dc5044 | 397 | |
53dc5044 | 398 | template<typename _Tp> |
123c516a PC |
399 | struct is_rvalue_reference<_Tp&&> |
400 | : public true_type { }; | |
401 | ||
402 | template<typename> | |
53dc5044 PC |
403 | struct is_function; |
404 | ||
405 | template<typename> | |
406 | struct __is_member_object_pointer_helper | |
407 | : public false_type { }; | |
123c516a PC |
408 | |
409 | template<typename _Tp, typename _Cp> | |
410 | struct __is_member_object_pointer_helper<_Tp _Cp::*> | |
411 | : public integral_constant<bool, !is_function<_Tp>::value> { }; | |
53dc5044 PC |
412 | |
413 | /// is_member_object_pointer | |
414 | template<typename _Tp> | |
415 | struct is_member_object_pointer | |
82b12c4b FD |
416 | : public __is_member_object_pointer_helper< |
417 | typename remove_cv<_Tp>::type>::type | |
53dc5044 PC |
418 | { }; |
419 | ||
420 | template<typename> | |
421 | struct __is_member_function_pointer_helper | |
422 | : public false_type { }; | |
123c516a PC |
423 | |
424 | template<typename _Tp, typename _Cp> | |
425 | struct __is_member_function_pointer_helper<_Tp _Cp::*> | |
426 | : public integral_constant<bool, is_function<_Tp>::value> { }; | |
53dc5044 PC |
427 | |
428 | /// is_member_function_pointer | |
429 | template<typename _Tp> | |
430 | struct is_member_function_pointer | |
82b12c4b FD |
431 | : public __is_member_function_pointer_helper< |
432 | typename remove_cv<_Tp>::type>::type | |
53dc5044 PC |
433 | { }; |
434 | ||
435 | /// is_enum | |
436 | template<typename _Tp> | |
437 | struct is_enum | |
438 | : public integral_constant<bool, __is_enum(_Tp)> | |
439 | { }; | |
440 | ||
441 | /// is_union | |
442 | template<typename _Tp> | |
443 | struct is_union | |
444 | : public integral_constant<bool, __is_union(_Tp)> | |
445 | { }; | |
446 | ||
447 | /// is_class | |
448 | template<typename _Tp> | |
449 | struct is_class | |
450 | : public integral_constant<bool, __is_class(_Tp)> | |
451 | { }; | |
452 | ||
453 | /// is_function | |
454 | template<typename> | |
455 | struct is_function | |
456 | : public false_type { }; | |
123c516a | 457 | |
51dc6603 JM |
458 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
459 | struct is_function<_Res(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL> | |
53dc5044 | 460 | : public true_type { }; |
123c516a | 461 | |
51dc6603 JM |
462 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
463 | struct is_function<_Res(_ArgTypes...) & _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
464 | : public true_type { }; |
465 | ||
51dc6603 JM |
466 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
467 | struct is_function<_Res(_ArgTypes...) && _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
468 | : public true_type { }; |
469 | ||
51dc6603 JM |
470 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
471 | struct is_function<_Res(_ArgTypes......) _GLIBCXX_NOEXCEPT_QUAL> | |
53dc5044 | 472 | : public true_type { }; |
123c516a | 473 | |
51dc6603 JM |
474 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
475 | struct is_function<_Res(_ArgTypes......) & _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
476 | : public true_type { }; |
477 | ||
51dc6603 JM |
478 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
479 | struct is_function<_Res(_ArgTypes......) && _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
480 | : public true_type { }; |
481 | ||
51dc6603 JM |
482 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
483 | struct is_function<_Res(_ArgTypes...) const _GLIBCXX_NOEXCEPT_QUAL> | |
53dc5044 | 484 | : public true_type { }; |
123c516a | 485 | |
51dc6603 JM |
486 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
487 | struct is_function<_Res(_ArgTypes...) const & _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
488 | : public true_type { }; |
489 | ||
51dc6603 JM |
490 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
491 | struct is_function<_Res(_ArgTypes...) const && _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
492 | : public true_type { }; |
493 | ||
51dc6603 JM |
494 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
495 | struct is_function<_Res(_ArgTypes......) const _GLIBCXX_NOEXCEPT_QUAL> | |
53dc5044 | 496 | : public true_type { }; |
123c516a | 497 | |
51dc6603 JM |
498 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
499 | struct is_function<_Res(_ArgTypes......) const & _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
500 | : public true_type { }; |
501 | ||
51dc6603 JM |
502 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
503 | struct is_function<_Res(_ArgTypes......) const && _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
504 | : public true_type { }; |
505 | ||
51dc6603 JM |
506 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
507 | struct is_function<_Res(_ArgTypes...) volatile _GLIBCXX_NOEXCEPT_QUAL> | |
53dc5044 | 508 | : public true_type { }; |
123c516a | 509 | |
51dc6603 JM |
510 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
511 | struct is_function<_Res(_ArgTypes...) volatile & _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
512 | : public true_type { }; |
513 | ||
51dc6603 JM |
514 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
515 | struct is_function<_Res(_ArgTypes...) volatile && _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
516 | : public true_type { }; |
517 | ||
51dc6603 JM |
518 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
519 | struct is_function<_Res(_ArgTypes......) volatile _GLIBCXX_NOEXCEPT_QUAL> | |
53dc5044 | 520 | : public true_type { }; |
123c516a | 521 | |
51dc6603 JM |
522 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
523 | struct is_function<_Res(_ArgTypes......) volatile & _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
524 | : public true_type { }; |
525 | ||
51dc6603 JM |
526 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
527 | struct is_function<_Res(_ArgTypes......) volatile && _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
528 | : public true_type { }; |
529 | ||
51dc6603 JM |
530 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
531 | struct is_function<_Res(_ArgTypes...) const volatile _GLIBCXX_NOEXCEPT_QUAL> | |
53dc5044 | 532 | : public true_type { }; |
123c516a | 533 | |
51dc6603 JM |
534 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
535 | struct is_function<_Res(_ArgTypes...) const volatile & _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
536 | : public true_type { }; |
537 | ||
51dc6603 JM |
538 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
539 | struct is_function<_Res(_ArgTypes...) const volatile && _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
540 | : public true_type { }; |
541 | ||
51dc6603 JM |
542 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
543 | struct is_function<_Res(_ArgTypes......) const volatile _GLIBCXX_NOEXCEPT_QUAL> | |
53dc5044 PC |
544 | : public true_type { }; |
545 | ||
51dc6603 JM |
546 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
547 | struct is_function<_Res(_ArgTypes......) const volatile & _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
548 | : public true_type { }; |
549 | ||
51dc6603 JM |
550 | template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM> |
551 | struct is_function<_Res(_ArgTypes......) const volatile && _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
552 | : public true_type { }; |
553 | ||
a15f7cb8 ESR |
554 | #define __cpp_lib_is_null_pointer 201309 |
555 | ||
1e673415 | 556 | template<typename> |
aa940ab5 | 557 | struct __is_null_pointer_helper |
1e673415 | 558 | : public false_type { }; |
123c516a PC |
559 | |
560 | template<> | |
aa940ab5 | 561 | struct __is_null_pointer_helper<std::nullptr_t> |
123c516a | 562 | : public true_type { }; |
1e673415 | 563 | |
aa940ab5 PC |
564 | /// is_null_pointer (LWG 2247). |
565 | template<typename _Tp> | |
566 | struct is_null_pointer | |
567 | : public __is_null_pointer_helper<typename remove_cv<_Tp>::type>::type | |
568 | { }; | |
569 | ||
570 | /// __is_nullptr_t (extension). | |
1e673415 PC |
571 | template<typename _Tp> |
572 | struct __is_nullptr_t | |
aa940ab5 | 573 | : public is_null_pointer<_Tp> |
1e673415 PC |
574 | { }; |
575 | ||
c0ffa2ba | 576 | // Composite type categories. |
123c516a PC |
577 | |
578 | /// is_reference | |
579 | template<typename _Tp> | |
580 | struct is_reference | |
581 | : public __or_<is_lvalue_reference<_Tp>, | |
582 | is_rvalue_reference<_Tp>>::type | |
583 | { }; | |
584 | ||
53dc5044 PC |
585 | /// is_arithmetic |
586 | template<typename _Tp> | |
587 | struct is_arithmetic | |
123c516a | 588 | : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type |
53dc5044 PC |
589 | { }; |
590 | ||
591 | /// is_fundamental | |
592 | template<typename _Tp> | |
593 | struct is_fundamental | |
aa940ab5 PC |
594 | : public __or_<is_arithmetic<_Tp>, is_void<_Tp>, |
595 | is_null_pointer<_Tp>>::type | |
53dc5044 PC |
596 | { }; |
597 | ||
598 | /// is_object | |
599 | template<typename _Tp> | |
600 | struct is_object | |
123c516a PC |
601 | : public __not_<__or_<is_function<_Tp>, is_reference<_Tp>, |
602 | is_void<_Tp>>>::type | |
53dc5044 PC |
603 | { }; |
604 | ||
123c516a | 605 | template<typename> |
53dc5044 PC |
606 | struct is_member_pointer; |
607 | ||
608 | /// is_scalar | |
609 | template<typename _Tp> | |
610 | struct is_scalar | |
123c516a | 611 | : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>, |
aa940ab5 | 612 | is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type |
53dc5044 PC |
613 | { }; |
614 | ||
615 | /// is_compound | |
616 | template<typename _Tp> | |
617 | struct is_compound | |
618 | : public integral_constant<bool, !is_fundamental<_Tp>::value> { }; | |
619 | ||
53dc5044 PC |
620 | template<typename _Tp> |
621 | struct __is_member_pointer_helper | |
622 | : public false_type { }; | |
123c516a PC |
623 | |
624 | template<typename _Tp, typename _Cp> | |
625 | struct __is_member_pointer_helper<_Tp _Cp::*> | |
626 | : public true_type { }; | |
53dc5044 | 627 | |
13901e4b | 628 | /// is_member_pointer |
53dc5044 | 629 | template<typename _Tp> |
123c516a | 630 | struct is_member_pointer |
82b12c4b | 631 | : public __is_member_pointer_helper<typename remove_cv<_Tp>::type>::type |
53dc5044 PC |
632 | { }; |
633 | ||
89898034 DK |
634 | // Utility to detect referenceable types ([defns.referenceable]). |
635 | ||
636 | template<typename _Tp> | |
637 | struct __is_referenceable | |
638 | : public __or_<is_object<_Tp>, is_reference<_Tp>>::type | |
639 | { }; | |
640 | ||
c6ab9061 JW |
641 | template<typename _Res, typename... _Args _GLIBCXX_NOEXCEPT_PARM> |
642 | struct __is_referenceable<_Res(_Args...) _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
643 | : public true_type |
644 | { }; | |
645 | ||
c6ab9061 JW |
646 | template<typename _Res, typename... _Args _GLIBCXX_NOEXCEPT_PARM> |
647 | struct __is_referenceable<_Res(_Args......) _GLIBCXX_NOEXCEPT_QUAL> | |
89898034 DK |
648 | : public true_type |
649 | { }; | |
650 | ||
c0ffa2ba | 651 | // Type properties. |
123c516a | 652 | |
53dc5044 PC |
653 | /// is_const |
654 | template<typename> | |
655 | struct is_const | |
656 | : public false_type { }; | |
657 | ||
658 | template<typename _Tp> | |
659 | struct is_const<_Tp const> | |
660 | : public true_type { }; | |
33ac58d5 | 661 | |
53dc5044 PC |
662 | /// is_volatile |
663 | template<typename> | |
664 | struct is_volatile | |
665 | : public false_type { }; | |
666 | ||
667 | template<typename _Tp> | |
668 | struct is_volatile<_Tp volatile> | |
669 | : public true_type { }; | |
670 | ||
123c516a PC |
671 | /// is_trivial |
672 | template<typename _Tp> | |
673 | struct is_trivial | |
674 | : public integral_constant<bool, __is_trivial(_Tp)> | |
675 | { }; | |
676 | ||
f5e523b7 VV |
677 | // is_trivially_copyable |
678 | template<typename _Tp> | |
679 | struct is_trivially_copyable | |
680 | : public integral_constant<bool, __is_trivially_copyable(_Tp)> | |
681 | { }; | |
123c516a PC |
682 | |
683 | /// is_standard_layout | |
684 | template<typename _Tp> | |
685 | struct is_standard_layout | |
686 | : public integral_constant<bool, __is_standard_layout(_Tp)> | |
687 | { }; | |
688 | ||
689 | /// is_pod | |
690 | // Could use is_standard_layout && is_trivial instead of the builtin. | |
691 | template<typename _Tp> | |
692 | struct is_pod | |
693 | : public integral_constant<bool, __is_pod(_Tp)> | |
694 | { }; | |
695 | ||
696 | /// is_literal_type | |
697 | template<typename _Tp> | |
698 | struct is_literal_type | |
699 | : public integral_constant<bool, __is_literal_type(_Tp)> | |
700 | { }; | |
701 | ||
53dc5044 PC |
702 | /// is_empty |
703 | template<typename _Tp> | |
704 | struct is_empty | |
705 | : public integral_constant<bool, __is_empty(_Tp)> | |
706 | { }; | |
707 | ||
708 | /// is_polymorphic | |
709 | template<typename _Tp> | |
710 | struct is_polymorphic | |
711 | : public integral_constant<bool, __is_polymorphic(_Tp)> | |
712 | { }; | |
713 | ||
4db7fcb9 ESR |
714 | #if __cplusplus >= 201402L |
715 | #define __cpp_lib_is_final 201402L | |
716 | /// is_final | |
717 | template<typename _Tp> | |
718 | struct is_final | |
719 | : public integral_constant<bool, __is_final(_Tp)> | |
720 | { }; | |
721 | #endif | |
722 | ||
53dc5044 PC |
723 | /// is_abstract |
724 | template<typename _Tp> | |
725 | struct is_abstract | |
726 | : public integral_constant<bool, __is_abstract(_Tp)> | |
727 | { }; | |
728 | ||
123c516a | 729 | template<typename _Tp, |
6a4b1a00 | 730 | bool = is_arithmetic<_Tp>::value> |
123c516a PC |
731 | struct __is_signed_helper |
732 | : public false_type { }; | |
733 | ||
53dc5044 | 734 | template<typename _Tp> |
6a4b1a00 PC |
735 | struct __is_signed_helper<_Tp, true> |
736 | : public integral_constant<bool, _Tp(-1) < _Tp(0)> | |
53dc5044 PC |
737 | { }; |
738 | ||
123c516a | 739 | /// is_signed |
53dc5044 | 740 | template<typename _Tp> |
123c516a | 741 | struct is_signed |
82b12c4b | 742 | : public __is_signed_helper<_Tp>::type |
123c516a PC |
743 | { }; |
744 | ||
745 | /// is_unsigned | |
746 | template<typename _Tp> | |
747 | struct is_unsigned | |
f7632193 | 748 | : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>> |
123c516a PC |
749 | { }; |
750 | ||
751 | ||
c0ffa2ba | 752 | // Destructible and constructible type properties. |
123c516a | 753 | |
13901e4b JW |
754 | /** |
755 | * @brief Utility to simplify expressions used in unevaluated operands | |
756 | * @ingroup utilities | |
757 | */ | |
ec26ff5a JW |
758 | |
759 | template<typename _Tp, typename _Up = _Tp&&> | |
760 | _Up | |
761 | __declval(int); | |
762 | ||
763 | template<typename _Tp> | |
764 | _Tp | |
765 | __declval(long); | |
766 | ||
53dc5044 | 767 | template<typename _Tp> |
ec26ff5a | 768 | auto declval() noexcept -> decltype(__declval<_Tp>(0)); |
53dc5044 | 769 | |
123c516a PC |
770 | template<typename, unsigned = 0> |
771 | struct extent; | |
772 | ||
773 | template<typename> | |
774 | struct remove_all_extents; | |
775 | ||
776 | template<typename _Tp> | |
777 | struct __is_array_known_bounds | |
778 | : public integral_constant<bool, (extent<_Tp>::value > 0)> | |
53dc5044 PC |
779 | { }; |
780 | ||
123c516a PC |
781 | template<typename _Tp> |
782 | struct __is_array_unknown_bounds | |
f7632193 | 783 | : public __and_<is_array<_Tp>, __not_<extent<_Tp>>> |
53dc5044 | 784 | { }; |
33ac58d5 | 785 | |
62fa805f | 786 | // In N3290 is_destructible does not say anything about function |
2c7a09d7 | 787 | // types and abstract types, see LWG 2049. This implementation |
62fa805f DK |
788 | // describes function types as non-destructible and all complete |
789 | // object types as destructible, iff the explicit destructor | |
2c7a09d7 | 790 | // call expression is wellformed. |
62fa805f | 791 | struct __do_is_destructible_impl |
123c516a | 792 | { |
62fa805f | 793 | template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())> |
123c516a PC |
794 | static true_type __test(int); |
795 | ||
796 | template<typename> | |
797 | static false_type __test(...); | |
798 | }; | |
53dc5044 PC |
799 | |
800 | template<typename _Tp> | |
62fa805f DK |
801 | struct __is_destructible_impl |
802 | : public __do_is_destructible_impl | |
123c516a PC |
803 | { |
804 | typedef decltype(__test<_Tp>(0)) type; | |
805 | }; | |
53dc5044 | 806 | |
62fa805f DK |
807 | template<typename _Tp, |
808 | bool = __or_<is_void<_Tp>, | |
809 | __is_array_unknown_bounds<_Tp>, | |
810 | is_function<_Tp>>::value, | |
811 | bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value> | |
812 | struct __is_destructible_safe; | |
813 | ||
814 | template<typename _Tp> | |
815 | struct __is_destructible_safe<_Tp, false, false> | |
816 | : public __is_destructible_impl<typename | |
817 | remove_all_extents<_Tp>::type>::type | |
818 | { }; | |
819 | ||
820 | template<typename _Tp> | |
821 | struct __is_destructible_safe<_Tp, true, false> | |
822 | : public false_type { }; | |
823 | ||
824 | template<typename _Tp> | |
825 | struct __is_destructible_safe<_Tp, false, true> | |
826 | : public true_type { }; | |
827 | ||
828 | /// is_destructible | |
829 | template<typename _Tp> | |
830 | struct is_destructible | |
82b12c4b | 831 | : public __is_destructible_safe<_Tp>::type |
62fa805f DK |
832 | { }; |
833 | ||
834 | // is_nothrow_destructible requires that is_destructible is | |
835 | // satisfied as well. We realize that by mimicing the | |
836 | // implementation of is_destructible but refer to noexcept(expr) | |
837 | // instead of decltype(expr). | |
838 | struct __do_is_nt_destructible_impl | |
123c516a | 839 | { |
62fa805f DK |
840 | template<typename _Tp> |
841 | static integral_constant<bool, noexcept(declval<_Tp&>().~_Tp())> | |
842 | __test(int); | |
123c516a PC |
843 | |
844 | template<typename> | |
845 | static false_type __test(...); | |
846 | }; | |
53dc5044 | 847 | |
53dc5044 | 848 | template<typename _Tp> |
62fa805f DK |
849 | struct __is_nt_destructible_impl |
850 | : public __do_is_nt_destructible_impl | |
123c516a PC |
851 | { |
852 | typedef decltype(__test<_Tp>(0)) type; | |
853 | }; | |
854 | ||
855 | template<typename _Tp, | |
856 | bool = __or_<is_void<_Tp>, | |
62fa805f DK |
857 | __is_array_unknown_bounds<_Tp>, |
858 | is_function<_Tp>>::value, | |
859 | bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value> | |
860 | struct __is_nt_destructible_safe; | |
53dc5044 PC |
861 | |
862 | template<typename _Tp> | |
62fa805f DK |
863 | struct __is_nt_destructible_safe<_Tp, false, false> |
864 | : public __is_nt_destructible_impl<typename | |
865 | remove_all_extents<_Tp>::type>::type | |
123c516a PC |
866 | { }; |
867 | ||
53dc5044 | 868 | template<typename _Tp> |
62fa805f | 869 | struct __is_nt_destructible_safe<_Tp, true, false> |
123c516a | 870 | : public false_type { }; |
53dc5044 PC |
871 | |
872 | template<typename _Tp> | |
62fa805f | 873 | struct __is_nt_destructible_safe<_Tp, false, true> |
123c516a PC |
874 | : public true_type { }; |
875 | ||
62fa805f | 876 | /// is_nothrow_destructible |
53dc5044 | 877 | template<typename _Tp> |
62fa805f | 878 | struct is_nothrow_destructible |
82b12c4b | 879 | : public __is_nt_destructible_safe<_Tp>::type |
123c516a PC |
880 | { }; |
881 | ||
882 | struct __do_is_default_constructible_impl | |
883 | { | |
884 | template<typename _Tp, typename = decltype(_Tp())> | |
885 | static true_type __test(int); | |
886 | ||
887 | template<typename> | |
888 | static false_type __test(...); | |
889 | }; | |
890 | ||
891 | template<typename _Tp> | |
892 | struct __is_default_constructible_impl | |
893 | : public __do_is_default_constructible_impl | |
53dc5044 | 894 | { |
123c516a | 895 | typedef decltype(__test<_Tp>(0)) type; |
53dc5044 | 896 | }; |
53dc5044 PC |
897 | |
898 | template<typename _Tp> | |
123c516a | 899 | struct __is_default_constructible_atom |
2c7a09d7 | 900 | : public __and_<__not_<is_void<_Tp>>, |
f7632193 | 901 | __is_default_constructible_impl<_Tp>> |
123c516a | 902 | { }; |
53dc5044 | 903 | |
123c516a PC |
904 | template<typename _Tp, bool = is_array<_Tp>::value> |
905 | struct __is_default_constructible_safe; | |
53dc5044 | 906 | |
2c7a09d7 | 907 | // The following technique is a workaround for a current core language |
33ac58d5 | 908 | // restriction, which does not allow for array types to occur in |
2c7a09d7 | 909 | // functional casts of the form T(). Complete arrays can be default- |
33ac58d5 | 910 | // constructed, if the element type is default-constructible, but |
2c7a09d7 | 911 | // arrays with unknown bounds are not. |
53dc5044 | 912 | template<typename _Tp> |
123c516a PC |
913 | struct __is_default_constructible_safe<_Tp, true> |
914 | : public __and_<__is_array_known_bounds<_Tp>, | |
915 | __is_default_constructible_atom<typename | |
f7632193 | 916 | remove_all_extents<_Tp>::type>> |
53dc5044 PC |
917 | { }; |
918 | ||
53dc5044 | 919 | template<typename _Tp> |
123c516a PC |
920 | struct __is_default_constructible_safe<_Tp, false> |
921 | : public __is_default_constructible_atom<_Tp>::type | |
922 | { }; | |
4a27a739 | 923 | |
123c516a | 924 | /// is_default_constructible |
4a27a739 | 925 | template<typename _Tp> |
123c516a | 926 | struct is_default_constructible |
82b12c4b | 927 | : public __is_default_constructible_safe<_Tp>::type |
123c516a | 928 | { }; |
4a27a739 | 929 | |
b0302c68 | 930 | /// is_constructible |
b0302c68 PC |
931 | template<typename _Tp, typename... _Args> |
932 | struct is_constructible | |
b42cc3ca | 933 | : public __bool_constant<__is_constructible(_Tp, _Args...)> |
c32097d8 JM |
934 | { }; |
935 | ||
89898034 | 936 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
65cee9bd | 937 | struct __is_copy_constructible_impl; |
123c516a | 938 | |
65cee9bd | 939 | template<typename _Tp> |
89898034 | 940 | struct __is_copy_constructible_impl<_Tp, false> |
65cee9bd PC |
941 | : public false_type { }; |
942 | ||
943 | template<typename _Tp> | |
89898034 | 944 | struct __is_copy_constructible_impl<_Tp, true> |
65cee9bd PC |
945 | : public is_constructible<_Tp, const _Tp&> |
946 | { }; | |
947 | ||
948 | /// is_copy_constructible | |
949 | template<typename _Tp> | |
950 | struct is_copy_constructible | |
951 | : public __is_copy_constructible_impl<_Tp> | |
952 | { }; | |
953 | ||
89898034 | 954 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
65cee9bd PC |
955 | struct __is_move_constructible_impl; |
956 | ||
957 | template<typename _Tp> | |
89898034 | 958 | struct __is_move_constructible_impl<_Tp, false> |
65cee9bd PC |
959 | : public false_type { }; |
960 | ||
961 | template<typename _Tp> | |
89898034 | 962 | struct __is_move_constructible_impl<_Tp, true> |
65cee9bd PC |
963 | : public is_constructible<_Tp, _Tp&&> |
964 | { }; | |
965 | ||
966 | /// is_move_constructible | |
967 | template<typename _Tp> | |
968 | struct is_move_constructible | |
969 | : public __is_move_constructible_impl<_Tp> | |
970 | { }; | |
971 | ||
972 | template<typename _Tp> | |
973 | struct __is_nt_default_constructible_atom | |
974 | : public integral_constant<bool, noexcept(_Tp())> | |
975 | { }; | |
976 | ||
977 | template<typename _Tp, bool = is_array<_Tp>::value> | |
978 | struct __is_nt_default_constructible_impl; | |
979 | ||
980 | template<typename _Tp> | |
981 | struct __is_nt_default_constructible_impl<_Tp, true> | |
982 | : public __and_<__is_array_known_bounds<_Tp>, | |
983 | __is_nt_default_constructible_atom<typename | |
f7632193 | 984 | remove_all_extents<_Tp>::type>> |
65cee9bd PC |
985 | { }; |
986 | ||
987 | template<typename _Tp> | |
988 | struct __is_nt_default_constructible_impl<_Tp, false> | |
989 | : public __is_nt_default_constructible_atom<_Tp> | |
990 | { }; | |
991 | ||
992 | /// is_nothrow_default_constructible | |
993 | template<typename _Tp> | |
994 | struct is_nothrow_default_constructible | |
995 | : public __and_<is_default_constructible<_Tp>, | |
f7632193 | 996 | __is_nt_default_constructible_impl<_Tp>> |
65cee9bd | 997 | { }; |
e4f32cb0 PC |
998 | |
999 | template<typename _Tp, typename... _Args> | |
65cee9bd PC |
1000 | struct __is_nt_constructible_impl |
1001 | : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> | |
1002 | { }; | |
e4f32cb0 PC |
1003 | |
1004 | template<typename _Tp, typename _Arg> | |
65cee9bd PC |
1005 | struct __is_nt_constructible_impl<_Tp, _Arg> |
1006 | : public integral_constant<bool, | |
1007 | noexcept(static_cast<_Tp>(declval<_Arg>()))> | |
1008 | { }; | |
1009 | ||
1010 | template<typename _Tp> | |
1011 | struct __is_nt_constructible_impl<_Tp> | |
1012 | : public is_nothrow_default_constructible<_Tp> | |
1013 | { }; | |
e4f32cb0 PC |
1014 | |
1015 | /// is_nothrow_constructible | |
1016 | template<typename _Tp, typename... _Args> | |
1017 | struct is_nothrow_constructible | |
65cee9bd | 1018 | : public __and_<is_constructible<_Tp, _Args...>, |
f7632193 | 1019 | __is_nt_constructible_impl<_Tp, _Args...>> |
65cee9bd PC |
1020 | { }; |
1021 | ||
89898034 | 1022 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
65cee9bd PC |
1023 | struct __is_nothrow_copy_constructible_impl; |
1024 | ||
1025 | template<typename _Tp> | |
89898034 | 1026 | struct __is_nothrow_copy_constructible_impl<_Tp, false> |
65cee9bd PC |
1027 | : public false_type { }; |
1028 | ||
1029 | template<typename _Tp> | |
89898034 | 1030 | struct __is_nothrow_copy_constructible_impl<_Tp, true> |
65cee9bd PC |
1031 | : public is_nothrow_constructible<_Tp, const _Tp&> |
1032 | { }; | |
1033 | ||
1034 | /// is_nothrow_copy_constructible | |
1035 | template<typename _Tp> | |
1036 | struct is_nothrow_copy_constructible | |
1037 | : public __is_nothrow_copy_constructible_impl<_Tp> | |
1038 | { }; | |
1039 | ||
89898034 | 1040 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
65cee9bd PC |
1041 | struct __is_nothrow_move_constructible_impl; |
1042 | ||
1043 | template<typename _Tp> | |
89898034 | 1044 | struct __is_nothrow_move_constructible_impl<_Tp, false> |
65cee9bd PC |
1045 | : public false_type { }; |
1046 | ||
1047 | template<typename _Tp> | |
89898034 | 1048 | struct __is_nothrow_move_constructible_impl<_Tp, true> |
65cee9bd PC |
1049 | : public is_nothrow_constructible<_Tp, _Tp&&> |
1050 | { }; | |
1051 | ||
1052 | /// is_nothrow_move_constructible | |
1053 | template<typename _Tp> | |
1054 | struct is_nothrow_move_constructible | |
1055 | : public __is_nothrow_move_constructible_impl<_Tp> | |
1056 | { }; | |
1057 | ||
f263981a PC |
1058 | /// is_assignable |
1059 | template<typename _Tp, typename _Up> | |
1060 | struct is_assignable | |
b42cc3ca | 1061 | : public __bool_constant<__is_assignable(_Tp, _Up)> |
f263981a PC |
1062 | { }; |
1063 | ||
89898034 | 1064 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
f263981a PC |
1065 | struct __is_copy_assignable_impl; |
1066 | ||
1067 | template<typename _Tp> | |
89898034 | 1068 | struct __is_copy_assignable_impl<_Tp, false> |
f263981a PC |
1069 | : public false_type { }; |
1070 | ||
1071 | template<typename _Tp> | |
89898034 | 1072 | struct __is_copy_assignable_impl<_Tp, true> |
9b3a81da | 1073 | : public is_assignable<_Tp&, const _Tp&> |
f263981a PC |
1074 | { }; |
1075 | ||
1076 | /// is_copy_assignable | |
1077 | template<typename _Tp> | |
1078 | struct is_copy_assignable | |
1079 | : public __is_copy_assignable_impl<_Tp> | |
1080 | { }; | |
1081 | ||
89898034 | 1082 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
f263981a PC |
1083 | struct __is_move_assignable_impl; |
1084 | ||
1085 | template<typename _Tp> | |
89898034 | 1086 | struct __is_move_assignable_impl<_Tp, false> |
f263981a PC |
1087 | : public false_type { }; |
1088 | ||
1089 | template<typename _Tp> | |
89898034 | 1090 | struct __is_move_assignable_impl<_Tp, true> |
f263981a PC |
1091 | : public is_assignable<_Tp&, _Tp&&> |
1092 | { }; | |
1093 | ||
1094 | /// is_move_assignable | |
1095 | template<typename _Tp> | |
1096 | struct is_move_assignable | |
1097 | : public __is_move_assignable_impl<_Tp> | |
1098 | { }; | |
1099 | ||
1100 | template<typename _Tp, typename _Up> | |
1101 | struct __is_nt_assignable_impl | |
1102 | : public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Up>())> | |
1103 | { }; | |
1104 | ||
1105 | /// is_nothrow_assignable | |
1106 | template<typename _Tp, typename _Up> | |
1107 | struct is_nothrow_assignable | |
1108 | : public __and_<is_assignable<_Tp, _Up>, | |
f7632193 | 1109 | __is_nt_assignable_impl<_Tp, _Up>> |
f263981a PC |
1110 | { }; |
1111 | ||
89898034 | 1112 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
f263981a PC |
1113 | struct __is_nt_copy_assignable_impl; |
1114 | ||
1115 | template<typename _Tp> | |
89898034 | 1116 | struct __is_nt_copy_assignable_impl<_Tp, false> |
f263981a PC |
1117 | : public false_type { }; |
1118 | ||
1119 | template<typename _Tp> | |
89898034 | 1120 | struct __is_nt_copy_assignable_impl<_Tp, true> |
9b3a81da | 1121 | : public is_nothrow_assignable<_Tp&, const _Tp&> |
f263981a PC |
1122 | { }; |
1123 | ||
1124 | /// is_nothrow_copy_assignable | |
1125 | template<typename _Tp> | |
1126 | struct is_nothrow_copy_assignable | |
1127 | : public __is_nt_copy_assignable_impl<_Tp> | |
1128 | { }; | |
1129 | ||
89898034 | 1130 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
f263981a PC |
1131 | struct __is_nt_move_assignable_impl; |
1132 | ||
1133 | template<typename _Tp> | |
89898034 | 1134 | struct __is_nt_move_assignable_impl<_Tp, false> |
f263981a PC |
1135 | : public false_type { }; |
1136 | ||
1137 | template<typename _Tp> | |
89898034 | 1138 | struct __is_nt_move_assignable_impl<_Tp, true> |
f263981a PC |
1139 | : public is_nothrow_assignable<_Tp&, _Tp&&> |
1140 | { }; | |
1141 | ||
1142 | /// is_nothrow_move_assignable | |
65cee9bd | 1143 | template<typename _Tp> |
f263981a PC |
1144 | struct is_nothrow_move_assignable |
1145 | : public __is_nt_move_assignable_impl<_Tp> | |
e4f32cb0 PC |
1146 | { }; |
1147 | ||
f5e523b7 VV |
1148 | /// is_trivially_constructible |
1149 | template<typename _Tp, typename... _Args> | |
1150 | struct is_trivially_constructible | |
b42cc3ca | 1151 | : public __bool_constant<__is_trivially_constructible(_Tp, _Args...)> |
f5e523b7 | 1152 | { }; |
33ac58d5 | 1153 | |
f5e523b7 VV |
1154 | /// is_trivially_default_constructible |
1155 | template<typename _Tp> | |
1156 | struct is_trivially_default_constructible | |
1157 | : public is_trivially_constructible<_Tp>::type | |
1158 | { }; | |
6a9ecd34 | 1159 | |
f7632193 VV |
1160 | struct __do_is_implicitly_default_constructible_impl |
1161 | { | |
1162 | template <typename _Tp> | |
1163 | static void __helper(const _Tp&); | |
1164 | ||
1165 | template <typename _Tp> | |
1166 | static true_type __test(const _Tp&, | |
1167 | decltype(__helper<const _Tp&>({}))* = 0); | |
1168 | ||
1169 | static false_type __test(...); | |
1170 | }; | |
1171 | ||
1172 | template<typename _Tp> | |
1173 | struct __is_implicitly_default_constructible_impl | |
1174 | : public __do_is_implicitly_default_constructible_impl | |
1175 | { | |
1176 | typedef decltype(__test(declval<_Tp>())) type; | |
1177 | }; | |
1178 | ||
1179 | template<typename _Tp> | |
1180 | struct __is_implicitly_default_constructible_safe | |
1181 | : public __is_implicitly_default_constructible_impl<_Tp>::type | |
1182 | { }; | |
1183 | ||
1184 | template <typename _Tp> | |
1185 | struct __is_implicitly_default_constructible | |
1186 | : public __and_<is_default_constructible<_Tp>, | |
1187 | __is_implicitly_default_constructible_safe<_Tp>> | |
1188 | { }; | |
1189 | ||
f5e523b7 | 1190 | /// is_trivially_copy_constructible |
b42cc3ca VV |
1191 | |
1192 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> | |
1193 | struct __is_trivially_copy_constructible_impl; | |
1194 | ||
f5e523b7 | 1195 | template<typename _Tp> |
b42cc3ca VV |
1196 | struct __is_trivially_copy_constructible_impl<_Tp, false> |
1197 | : public false_type { }; | |
1198 | ||
1199 | template<typename _Tp> | |
1200 | struct __is_trivially_copy_constructible_impl<_Tp, true> | |
33ac58d5 | 1201 | : public __and_<is_copy_constructible<_Tp>, |
f5e523b7 | 1202 | integral_constant<bool, |
f7632193 | 1203 | __is_trivially_constructible(_Tp, const _Tp&)>> |
f5e523b7 | 1204 | { }; |
33ac58d5 | 1205 | |
b42cc3ca VV |
1206 | template<typename _Tp> |
1207 | struct is_trivially_copy_constructible | |
1208 | : public __is_trivially_copy_constructible_impl<_Tp> | |
1209 | { }; | |
1210 | ||
f5e523b7 | 1211 | /// is_trivially_move_constructible |
b42cc3ca VV |
1212 | |
1213 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> | |
1214 | struct __is_trivially_move_constructible_impl; | |
1215 | ||
f5e523b7 | 1216 | template<typename _Tp> |
b42cc3ca VV |
1217 | struct __is_trivially_move_constructible_impl<_Tp, false> |
1218 | : public false_type { }; | |
1219 | ||
1220 | template<typename _Tp> | |
1221 | struct __is_trivially_move_constructible_impl<_Tp, true> | |
33ac58d5 | 1222 | : public __and_<is_move_constructible<_Tp>, |
f5e523b7 | 1223 | integral_constant<bool, |
f7632193 | 1224 | __is_trivially_constructible(_Tp, _Tp&&)>> |
f5e523b7 | 1225 | { }; |
6a9ecd34 | 1226 | |
b42cc3ca VV |
1227 | template<typename _Tp> |
1228 | struct is_trivially_move_constructible | |
1229 | : public __is_trivially_move_constructible_impl<_Tp> | |
1230 | { }; | |
1231 | ||
f5e523b7 VV |
1232 | /// is_trivially_assignable |
1233 | template<typename _Tp, typename _Up> | |
1234 | struct is_trivially_assignable | |
b42cc3ca | 1235 | : public __bool_constant<__is_trivially_assignable(_Tp, _Up)> |
f5e523b7 | 1236 | { }; |
6a9ecd34 | 1237 | |
f5e523b7 | 1238 | /// is_trivially_copy_assignable |
b42cc3ca VV |
1239 | |
1240 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> | |
1241 | struct __is_trivially_copy_assignable_impl; | |
1242 | ||
f5e523b7 | 1243 | template<typename _Tp> |
b42cc3ca VV |
1244 | struct __is_trivially_copy_assignable_impl<_Tp, false> |
1245 | : public false_type { }; | |
1246 | ||
1247 | template<typename _Tp> | |
1248 | struct __is_trivially_copy_assignable_impl<_Tp, true> | |
33ac58d5 | 1249 | : public __and_<is_copy_assignable<_Tp>, |
f5e523b7 | 1250 | integral_constant<bool, |
f7632193 | 1251 | __is_trivially_assignable(_Tp&, const _Tp&)>> |
f5e523b7 | 1252 | { }; |
6a9ecd34 | 1253 | |
b42cc3ca VV |
1254 | template<typename _Tp> |
1255 | struct is_trivially_copy_assignable | |
1256 | : public __is_trivially_copy_assignable_impl<_Tp> | |
1257 | { }; | |
1258 | ||
f5e523b7 | 1259 | /// is_trivially_move_assignable |
b42cc3ca VV |
1260 | |
1261 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> | |
1262 | struct __is_trivially_move_assignable_impl; | |
1263 | ||
f5e523b7 | 1264 | template<typename _Tp> |
b42cc3ca VV |
1265 | struct __is_trivially_move_assignable_impl<_Tp, false> |
1266 | : public false_type { }; | |
1267 | ||
1268 | template<typename _Tp> | |
1269 | struct __is_trivially_move_assignable_impl<_Tp, true> | |
33ac58d5 | 1270 | : public __and_<is_move_assignable<_Tp>, |
f5e523b7 | 1271 | integral_constant<bool, |
f7632193 | 1272 | __is_trivially_assignable(_Tp&, _Tp&&)>> |
f5e523b7 | 1273 | { }; |
6a9ecd34 | 1274 | |
b42cc3ca VV |
1275 | template<typename _Tp> |
1276 | struct is_trivially_move_assignable | |
1277 | : public __is_trivially_move_assignable_impl<_Tp> | |
1278 | { }; | |
1279 | ||
6a9ecd34 PC |
1280 | /// is_trivially_destructible |
1281 | template<typename _Tp> | |
1282 | struct is_trivially_destructible | |
1283 | : public __and_<is_destructible<_Tp>, integral_constant<bool, | |
f7632193 | 1284 | __has_trivial_destructor(_Tp)>> |
6a9ecd34 PC |
1285 | { }; |
1286 | ||
e133ace8 | 1287 | |
123c516a PC |
1288 | /// has_virtual_destructor |
1289 | template<typename _Tp> | |
1290 | struct has_virtual_destructor | |
1291 | : public integral_constant<bool, __has_virtual_destructor(_Tp)> | |
1292 | { }; | |
1293 | ||
33ac58d5 | 1294 | |
123c516a PC |
1295 | // type property queries. |
1296 | ||
1297 | /// alignment_of | |
1298 | template<typename _Tp> | |
1299 | struct alignment_of | |
1300 | : public integral_constant<std::size_t, __alignof__(_Tp)> { }; | |
33ac58d5 | 1301 | |
123c516a PC |
1302 | /// rank |
1303 | template<typename> | |
1304 | struct rank | |
1305 | : public integral_constant<std::size_t, 0> { }; | |
33ac58d5 | 1306 | |
123c516a PC |
1307 | template<typename _Tp, std::size_t _Size> |
1308 | struct rank<_Tp[_Size]> | |
1309 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | |
1310 | ||
1311 | template<typename _Tp> | |
1312 | struct rank<_Tp[]> | |
1313 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | |
1314 | ||
1315 | /// extent | |
1316 | template<typename, unsigned _Uint> | |
1317 | struct extent | |
1318 | : public integral_constant<std::size_t, 0> { }; | |
33ac58d5 | 1319 | |
123c516a PC |
1320 | template<typename _Tp, unsigned _Uint, std::size_t _Size> |
1321 | struct extent<_Tp[_Size], _Uint> | |
1322 | : public integral_constant<std::size_t, | |
1323 | _Uint == 0 ? _Size : extent<_Tp, | |
1324 | _Uint - 1>::value> | |
1325 | { }; | |
1326 | ||
1327 | template<typename _Tp, unsigned _Uint> | |
1328 | struct extent<_Tp[], _Uint> | |
1329 | : public integral_constant<std::size_t, | |
1330 | _Uint == 0 ? 0 : extent<_Tp, | |
1331 | _Uint - 1>::value> | |
1332 | { }; | |
1333 | ||
1334 | ||
c0ffa2ba | 1335 | // Type relations. |
123c516a PC |
1336 | |
1337 | /// is_same | |
1338 | template<typename, typename> | |
1339 | struct is_same | |
1340 | : public false_type { }; | |
1341 | ||
1342 | template<typename _Tp> | |
1343 | struct is_same<_Tp, _Tp> | |
1344 | : public true_type { }; | |
b0302c68 | 1345 | |
939759fc | 1346 | /// is_base_of |
e133ace8 PC |
1347 | template<typename _Base, typename _Derived> |
1348 | struct is_base_of | |
1349 | : public integral_constant<bool, __is_base_of(_Base, _Derived)> | |
1350 | { }; | |
1351 | ||
297f34d7 | 1352 | template<typename _From, typename _To, |
123c516a PC |
1353 | bool = __or_<is_void<_From>, is_function<_To>, |
1354 | is_array<_To>>::value> | |
297f34d7 | 1355 | struct __is_convertible_helper |
82b12c4b | 1356 | { typedef typename is_void<_To>::type type; }; |
297f34d7 | 1357 | |
e133ace8 | 1358 | template<typename _From, typename _To> |
b0302c68 | 1359 | class __is_convertible_helper<_From, _To, false> |
e133ace8 | 1360 | { |
82b12c4b FD |
1361 | template<typename _To1> |
1362 | static void __test_aux(_To1); | |
8e7d962a | 1363 | |
82b12c4b FD |
1364 | template<typename _From1, typename _To1, |
1365 | typename = decltype(__test_aux<_To1>(std::declval<_From1>()))> | |
1366 | static true_type | |
8e7d962a PC |
1367 | __test(int); |
1368 | ||
1369 | template<typename, typename> | |
82b12c4b FD |
1370 | static false_type |
1371 | __test(...); | |
297f34d7 | 1372 | |
e133ace8 | 1373 | public: |
82b12c4b | 1374 | typedef decltype(__test<_From, _To>(0)) type; |
e133ace8 PC |
1375 | }; |
1376 | ||
82b12c4b | 1377 | |
b0302c68 | 1378 | /// is_convertible |
e133ace8 PC |
1379 | template<typename _From, typename _To> |
1380 | struct is_convertible | |
82b12c4b | 1381 | : public __is_convertible_helper<_From, _To>::type |
e133ace8 PC |
1382 | { }; |
1383 | ||
fd735b6a | 1384 | |
c0ffa2ba | 1385 | // Const-volatile modifications. |
7b50cdef | 1386 | |
123c516a | 1387 | /// remove_const |
7b50cdef | 1388 | template<typename _Tp> |
123c516a PC |
1389 | struct remove_const |
1390 | { typedef _Tp type; }; | |
7b50cdef | 1391 | |
123c516a PC |
1392 | template<typename _Tp> |
1393 | struct remove_const<_Tp const> | |
1394 | { typedef _Tp type; }; | |
33ac58d5 | 1395 | |
123c516a PC |
1396 | /// remove_volatile |
1397 | template<typename _Tp> | |
1398 | struct remove_volatile | |
1399 | { typedef _Tp type; }; | |
7b50cdef | 1400 | |
123c516a PC |
1401 | template<typename _Tp> |
1402 | struct remove_volatile<_Tp volatile> | |
1403 | { typedef _Tp type; }; | |
33ac58d5 | 1404 | |
123c516a PC |
1405 | /// remove_cv |
1406 | template<typename _Tp> | |
1407 | struct remove_cv | |
1408 | { | |
1409 | typedef typename | |
1410 | remove_const<typename remove_volatile<_Tp>::type>::type type; | |
1411 | }; | |
33ac58d5 | 1412 | |
123c516a PC |
1413 | /// add_const |
1414 | template<typename _Tp> | |
1415 | struct add_const | |
1416 | { typedef _Tp const type; }; | |
33ac58d5 | 1417 | |
123c516a PC |
1418 | /// add_volatile |
1419 | template<typename _Tp> | |
1420 | struct add_volatile | |
1421 | { typedef _Tp volatile type; }; | |
33ac58d5 | 1422 | |
123c516a PC |
1423 | /// add_cv |
1424 | template<typename _Tp> | |
1425 | struct add_cv | |
1426 | { | |
1427 | typedef typename | |
1428 | add_const<typename add_volatile<_Tp>::type>::type type; | |
1429 | }; | |
7b50cdef | 1430 | |
4457e88c | 1431 | #if __cplusplus > 201103L |
a15f7cb8 ESR |
1432 | |
1433 | #define __cpp_lib_transformation_trait_aliases 201304 | |
1434 | ||
4457e88c JW |
1435 | /// Alias template for remove_const |
1436 | template<typename _Tp> | |
1437 | using remove_const_t = typename remove_const<_Tp>::type; | |
1438 | ||
1439 | /// Alias template for remove_volatile | |
1440 | template<typename _Tp> | |
1441 | using remove_volatile_t = typename remove_volatile<_Tp>::type; | |
1442 | ||
1443 | /// Alias template for remove_cv | |
1444 | template<typename _Tp> | |
1445 | using remove_cv_t = typename remove_cv<_Tp>::type; | |
1446 | ||
1447 | /// Alias template for add_const | |
1448 | template<typename _Tp> | |
1449 | using add_const_t = typename add_const<_Tp>::type; | |
1450 | ||
1451 | /// Alias template for add_volatile | |
1452 | template<typename _Tp> | |
1453 | using add_volatile_t = typename add_volatile<_Tp>::type; | |
1454 | ||
1455 | /// Alias template for add_cv | |
1456 | template<typename _Tp> | |
1457 | using add_cv_t = typename add_cv<_Tp>::type; | |
1458 | #endif | |
7b50cdef | 1459 | |
123c516a | 1460 | // Reference transformations. |
7b50cdef | 1461 | |
123c516a PC |
1462 | /// remove_reference |
1463 | template<typename _Tp> | |
1464 | struct remove_reference | |
1465 | { typedef _Tp type; }; | |
7b50cdef | 1466 | |
123c516a PC |
1467 | template<typename _Tp> |
1468 | struct remove_reference<_Tp&> | |
1469 | { typedef _Tp type; }; | |
7b50cdef | 1470 | |
123c516a PC |
1471 | template<typename _Tp> |
1472 | struct remove_reference<_Tp&&> | |
1473 | { typedef _Tp type; }; | |
1474 | ||
89898034 | 1475 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
123c516a PC |
1476 | struct __add_lvalue_reference_helper |
1477 | { typedef _Tp type; }; | |
7b50cdef | 1478 | |
5e108459 | 1479 | template<typename _Tp> |
89898034 | 1480 | struct __add_lvalue_reference_helper<_Tp, true> |
123c516a | 1481 | { typedef _Tp& type; }; |
5e108459 | 1482 | |
123c516a | 1483 | /// add_lvalue_reference |
5e108459 | 1484 | template<typename _Tp> |
123c516a PC |
1485 | struct add_lvalue_reference |
1486 | : public __add_lvalue_reference_helper<_Tp> | |
1487 | { }; | |
1488 | ||
89898034 | 1489 | template<typename _Tp, bool = __is_referenceable<_Tp>::value> |
123c516a PC |
1490 | struct __add_rvalue_reference_helper |
1491 | { typedef _Tp type; }; | |
5e108459 PC |
1492 | |
1493 | template<typename _Tp> | |
123c516a PC |
1494 | struct __add_rvalue_reference_helper<_Tp, true> |
1495 | { typedef _Tp&& type; }; | |
5e108459 | 1496 | |
123c516a | 1497 | /// add_rvalue_reference |
5e108459 | 1498 | template<typename _Tp> |
123c516a PC |
1499 | struct add_rvalue_reference |
1500 | : public __add_rvalue_reference_helper<_Tp> | |
1501 | { }; | |
5e108459 | 1502 | |
4457e88c JW |
1503 | #if __cplusplus > 201103L |
1504 | /// Alias template for remove_reference | |
1505 | template<typename _Tp> | |
1506 | using remove_reference_t = typename remove_reference<_Tp>::type; | |
1507 | ||
1508 | /// Alias template for add_lvalue_reference | |
1509 | template<typename _Tp> | |
1510 | using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; | |
1511 | ||
1512 | /// Alias template for add_rvalue_reference | |
1513 | template<typename _Tp> | |
1514 | using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; | |
1515 | #endif | |
7b50cdef | 1516 | |
c0ffa2ba | 1517 | // Sign modifications. |
123c516a | 1518 | |
7b50cdef BK |
1519 | // Utility for constructing identically cv-qualified types. |
1520 | template<typename _Unqualified, bool _IsConst, bool _IsVol> | |
1521 | struct __cv_selector; | |
1522 | ||
1523 | template<typename _Unqualified> | |
1524 | struct __cv_selector<_Unqualified, false, false> | |
1525 | { typedef _Unqualified __type; }; | |
1526 | ||
1527 | template<typename _Unqualified> | |
1528 | struct __cv_selector<_Unqualified, false, true> | |
1529 | { typedef volatile _Unqualified __type; }; | |
1530 | ||
1531 | template<typename _Unqualified> | |
1532 | struct __cv_selector<_Unqualified, true, false> | |
1533 | { typedef const _Unqualified __type; }; | |
1534 | ||
1535 | template<typename _Unqualified> | |
1536 | struct __cv_selector<_Unqualified, true, true> | |
1537 | { typedef const volatile _Unqualified __type; }; | |
1538 | ||
1539 | template<typename _Qualified, typename _Unqualified, | |
1540 | bool _IsConst = is_const<_Qualified>::value, | |
1541 | bool _IsVol = is_volatile<_Qualified>::value> | |
b0302c68 | 1542 | class __match_cv_qualifiers |
7b50cdef | 1543 | { |
7b50cdef BK |
1544 | typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match; |
1545 | ||
1546 | public: | |
33ac58d5 | 1547 | typedef typename __match::__type __type; |
7b50cdef BK |
1548 | }; |
1549 | ||
7b50cdef BK |
1550 | // Utility for finding the unsigned versions of signed integral types. |
1551 | template<typename _Tp> | |
e133ace8 PC |
1552 | struct __make_unsigned |
1553 | { typedef _Tp __type; }; | |
7b50cdef BK |
1554 | |
1555 | template<> | |
1556 | struct __make_unsigned<char> | |
1557 | { typedef unsigned char __type; }; | |
1558 | ||
1559 | template<> | |
1560 | struct __make_unsigned<signed char> | |
1561 | { typedef unsigned char __type; }; | |
1562 | ||
7b50cdef BK |
1563 | template<> |
1564 | struct __make_unsigned<short> | |
1565 | { typedef unsigned short __type; }; | |
1566 | ||
1567 | template<> | |
1568 | struct __make_unsigned<int> | |
1569 | { typedef unsigned int __type; }; | |
1570 | ||
1571 | template<> | |
1572 | struct __make_unsigned<long> | |
1573 | { typedef unsigned long __type; }; | |
1574 | ||
1575 | template<> | |
1576 | struct __make_unsigned<long long> | |
1577 | { typedef unsigned long long __type; }; | |
1578 | ||
c0eef1c8 JW |
1579 | #if defined(_GLIBCXX_USE_WCHAR_T) && !defined(__WCHAR_UNSIGNED__) |
1580 | template<> | |
1581 | struct __make_unsigned<wchar_t> : __make_unsigned<__WCHAR_TYPE__> | |
1582 | { }; | |
1583 | #endif | |
1584 | ||
78a7c317 DD |
1585 | #if defined(__GLIBCXX_TYPE_INT_N_0) |
1586 | template<> | |
1587 | struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0> | |
1588 | { typedef unsigned __GLIBCXX_TYPE_INT_N_0 __type; }; | |
1589 | #endif | |
1590 | #if defined(__GLIBCXX_TYPE_INT_N_1) | |
1591 | template<> | |
1592 | struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1> | |
1593 | { typedef unsigned __GLIBCXX_TYPE_INT_N_1 __type; }; | |
1594 | #endif | |
1595 | #if defined(__GLIBCXX_TYPE_INT_N_2) | |
6d585f01 | 1596 | template<> |
78a7c317 DD |
1597 | struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2> |
1598 | { typedef unsigned __GLIBCXX_TYPE_INT_N_2 __type; }; | |
1599 | #endif | |
1600 | #if defined(__GLIBCXX_TYPE_INT_N_3) | |
1601 | template<> | |
1602 | struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3> | |
1603 | { typedef unsigned __GLIBCXX_TYPE_INT_N_3 __type; }; | |
6d585f01 PC |
1604 | #endif |
1605 | ||
7b50cdef | 1606 | // Select between integral and enum: not possible to be both. |
33ac58d5 | 1607 | template<typename _Tp, |
7b50cdef | 1608 | bool _IsInt = is_integral<_Tp>::value, |
7b50cdef | 1609 | bool _IsEnum = is_enum<_Tp>::value> |
b0302c68 PC |
1610 | class __make_unsigned_selector; |
1611 | ||
7b50cdef | 1612 | template<typename _Tp> |
b0302c68 | 1613 | class __make_unsigned_selector<_Tp, true, false> |
7b50cdef | 1614 | { |
7b50cdef BK |
1615 | typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt; |
1616 | typedef typename __unsignedt::__type __unsigned_type; | |
1617 | typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned; | |
1618 | ||
1619 | public: | |
1620 | typedef typename __cv_unsigned::__type __type; | |
1621 | }; | |
1622 | ||
7b50cdef | 1623 | template<typename _Tp> |
b0302c68 | 1624 | class __make_unsigned_selector<_Tp, false, true> |
7b50cdef | 1625 | { |
a0230468 MM |
1626 | // With -fshort-enums, an enum may be as small as a char. |
1627 | typedef unsigned char __smallest; | |
1628 | static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest); | |
1629 | static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned short); | |
ce2e6349 | 1630 | static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned int); |
73d81d3a JW |
1631 | static const bool __b3 = sizeof(_Tp) <= sizeof(unsigned long); |
1632 | typedef conditional<__b3, unsigned long, unsigned long long> __cond3; | |
1633 | typedef typename __cond3::type __cond3_type; | |
1634 | typedef conditional<__b2, unsigned int, __cond3_type> __cond2; | |
a0230468 MM |
1635 | typedef typename __cond2::type __cond2_type; |
1636 | typedef conditional<__b1, unsigned short, __cond2_type> __cond1; | |
1637 | typedef typename __cond1::type __cond1_type; | |
7b50cdef | 1638 | |
73d81d3a JW |
1639 | typedef typename conditional<__b0, __smallest, __cond1_type>::type |
1640 | __unsigned_type; | |
1641 | typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned; | |
1642 | ||
7b50cdef | 1643 | public: |
73d81d3a | 1644 | typedef typename __cv_unsigned::__type __type; |
7b50cdef BK |
1645 | }; |
1646 | ||
7b50cdef BK |
1647 | // Given an integral/enum type, return the corresponding unsigned |
1648 | // integer type. | |
5b9daa7e BK |
1649 | // Primary template. |
1650 | /// make_unsigned | |
7b50cdef | 1651 | template<typename _Tp> |
33ac58d5 | 1652 | struct make_unsigned |
7b50cdef BK |
1653 | { typedef typename __make_unsigned_selector<_Tp>::__type type; }; |
1654 | ||
1655 | // Integral, but don't define. | |
1656 | template<> | |
1657 | struct make_unsigned<bool>; | |
1658 | ||
1659 | ||
1660 | // Utility for finding the signed versions of unsigned integral types. | |
1661 | template<typename _Tp> | |
e133ace8 PC |
1662 | struct __make_signed |
1663 | { typedef _Tp __type; }; | |
7b50cdef BK |
1664 | |
1665 | template<> | |
1666 | struct __make_signed<char> | |
1667 | { typedef signed char __type; }; | |
1668 | ||
1669 | template<> | |
1670 | struct __make_signed<unsigned char> | |
1671 | { typedef signed char __type; }; | |
1672 | ||
7b50cdef BK |
1673 | template<> |
1674 | struct __make_signed<unsigned short> | |
1675 | { typedef signed short __type; }; | |
1676 | ||
1677 | template<> | |
1678 | struct __make_signed<unsigned int> | |
1679 | { typedef signed int __type; }; | |
1680 | ||
1681 | template<> | |
1682 | struct __make_signed<unsigned long> | |
1683 | { typedef signed long __type; }; | |
1684 | ||
1685 | template<> | |
1686 | struct __make_signed<unsigned long long> | |
1687 | { typedef signed long long __type; }; | |
1688 | ||
c0eef1c8 JW |
1689 | #if defined(_GLIBCXX_USE_WCHAR_T) && defined(__WCHAR_UNSIGNED__) |
1690 | template<> | |
1691 | struct __make_signed<wchar_t> : __make_signed<__WCHAR_TYPE__> | |
1692 | { }; | |
1693 | #endif | |
1694 | ||
1695 | #ifdef _GLIBCXX_USE_C99_STDINT_TR1 | |
1696 | template<> | |
1697 | struct __make_signed<char16_t> : __make_signed<uint_least16_t> | |
1698 | { }; | |
1699 | template<> | |
1700 | struct __make_signed<char32_t> : __make_signed<uint_least32_t> | |
1701 | { }; | |
1702 | #endif | |
1703 | ||
78a7c317 DD |
1704 | #if defined(__GLIBCXX_TYPE_INT_N_0) |
1705 | template<> | |
1706 | struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0> | |
1707 | { typedef __GLIBCXX_TYPE_INT_N_0 __type; }; | |
1708 | #endif | |
1709 | #if defined(__GLIBCXX_TYPE_INT_N_1) | |
1710 | template<> | |
1711 | struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1> | |
1712 | { typedef __GLIBCXX_TYPE_INT_N_1 __type; }; | |
1713 | #endif | |
1714 | #if defined(__GLIBCXX_TYPE_INT_N_2) | |
1715 | template<> | |
1716 | struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2> | |
1717 | { typedef __GLIBCXX_TYPE_INT_N_2 __type; }; | |
1718 | #endif | |
1719 | #if defined(__GLIBCXX_TYPE_INT_N_3) | |
6d585f01 | 1720 | template<> |
78a7c317 DD |
1721 | struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3> |
1722 | { typedef __GLIBCXX_TYPE_INT_N_3 __type; }; | |
6d585f01 PC |
1723 | #endif |
1724 | ||
fb8ffd10 | 1725 | // Select between integral and enum: not possible to be both. |
33ac58d5 | 1726 | template<typename _Tp, |
7b50cdef | 1727 | bool _IsInt = is_integral<_Tp>::value, |
7b50cdef | 1728 | bool _IsEnum = is_enum<_Tp>::value> |
b0302c68 PC |
1729 | class __make_signed_selector; |
1730 | ||
7b50cdef | 1731 | template<typename _Tp> |
b0302c68 | 1732 | class __make_signed_selector<_Tp, true, false> |
7b50cdef | 1733 | { |
7b50cdef BK |
1734 | typedef __make_signed<typename remove_cv<_Tp>::type> __signedt; |
1735 | typedef typename __signedt::__type __signed_type; | |
1736 | typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed; | |
1737 | ||
1738 | public: | |
1739 | typedef typename __cv_signed::__type __type; | |
1740 | }; | |
1741 | ||
7b50cdef | 1742 | template<typename _Tp> |
b0302c68 | 1743 | class __make_signed_selector<_Tp, false, true> |
7b50cdef | 1744 | { |
73d81d3a | 1745 | typedef typename __make_unsigned_selector<_Tp>::__type __unsigned_type; |
7b50cdef BK |
1746 | |
1747 | public: | |
73d81d3a | 1748 | typedef typename __make_signed_selector<__unsigned_type>::__type __type; |
7b50cdef BK |
1749 | }; |
1750 | ||
7b50cdef BK |
1751 | // Given an integral/enum type, return the corresponding signed |
1752 | // integer type. | |
5b9daa7e BK |
1753 | // Primary template. |
1754 | /// make_signed | |
7b50cdef | 1755 | template<typename _Tp> |
33ac58d5 | 1756 | struct make_signed |
7b50cdef BK |
1757 | { typedef typename __make_signed_selector<_Tp>::__type type; }; |
1758 | ||
1759 | // Integral, but don't define. | |
1760 | template<> | |
1761 | struct make_signed<bool>; | |
cfa9a96b | 1762 | |
4457e88c JW |
1763 | #if __cplusplus > 201103L |
1764 | /// Alias template for make_signed | |
1765 | template<typename _Tp> | |
1766 | using make_signed_t = typename make_signed<_Tp>::type; | |
1767 | ||
1768 | /// Alias template for make_unsigned | |
1769 | template<typename _Tp> | |
1770 | using make_unsigned_t = typename make_unsigned<_Tp>::type; | |
1771 | #endif | |
123c516a | 1772 | |
c0ffa2ba | 1773 | // Array modifications. |
123c516a PC |
1774 | |
1775 | /// remove_extent | |
1776 | template<typename _Tp> | |
1777 | struct remove_extent | |
1778 | { typedef _Tp type; }; | |
1779 | ||
1780 | template<typename _Tp, std::size_t _Size> | |
1781 | struct remove_extent<_Tp[_Size]> | |
1782 | { typedef _Tp type; }; | |
1783 | ||
1784 | template<typename _Tp> | |
1785 | struct remove_extent<_Tp[]> | |
1786 | { typedef _Tp type; }; | |
1787 | ||
1788 | /// remove_all_extents | |
1789 | template<typename _Tp> | |
1790 | struct remove_all_extents | |
1791 | { typedef _Tp type; }; | |
1792 | ||
1793 | template<typename _Tp, std::size_t _Size> | |
1794 | struct remove_all_extents<_Tp[_Size]> | |
1795 | { typedef typename remove_all_extents<_Tp>::type type; }; | |
1796 | ||
1797 | template<typename _Tp> | |
1798 | struct remove_all_extents<_Tp[]> | |
1799 | { typedef typename remove_all_extents<_Tp>::type type; }; | |
1800 | ||
4457e88c JW |
1801 | #if __cplusplus > 201103L |
1802 | /// Alias template for remove_extent | |
1803 | template<typename _Tp> | |
1804 | using remove_extent_t = typename remove_extent<_Tp>::type; | |
1805 | ||
1806 | /// Alias template for remove_all_extents | |
1807 | template<typename _Tp> | |
1808 | using remove_all_extents_t = typename remove_all_extents<_Tp>::type; | |
1809 | #endif | |
123c516a | 1810 | |
c0ffa2ba | 1811 | // Pointer modifications. |
123c516a PC |
1812 | |
1813 | template<typename _Tp, typename> | |
1814 | struct __remove_pointer_helper | |
1815 | { typedef _Tp type; }; | |
1816 | ||
1817 | template<typename _Tp, typename _Up> | |
1818 | struct __remove_pointer_helper<_Tp, _Up*> | |
1819 | { typedef _Up type; }; | |
1820 | ||
1821 | /// remove_pointer | |
1822 | template<typename _Tp> | |
1823 | struct remove_pointer | |
1824 | : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type> | |
1825 | { }; | |
1826 | ||
1827 | /// add_pointer | |
89898034 DK |
1828 | template<typename _Tp, bool = __or_<__is_referenceable<_Tp>, |
1829 | is_void<_Tp>>::value> | |
1830 | struct __add_pointer_helper | |
1831 | { typedef _Tp type; }; | |
1832 | ||
123c516a | 1833 | template<typename _Tp> |
89898034 | 1834 | struct __add_pointer_helper<_Tp, true> |
123c516a PC |
1835 | { typedef typename remove_reference<_Tp>::type* type; }; |
1836 | ||
89898034 | 1837 | template<typename _Tp> |
33ac58d5 | 1838 | struct add_pointer |
89898034 DK |
1839 | : public __add_pointer_helper<_Tp> |
1840 | { }; | |
1841 | ||
4457e88c JW |
1842 | #if __cplusplus > 201103L |
1843 | /// Alias template for remove_pointer | |
1844 | template<typename _Tp> | |
1845 | using remove_pointer_t = typename remove_pointer<_Tp>::type; | |
1846 | ||
1847 | /// Alias template for add_pointer | |
1848 | template<typename _Tp> | |
1849 | using add_pointer_t = typename add_pointer<_Tp>::type; | |
1850 | #endif | |
123c516a PC |
1851 | |
1852 | template<std::size_t _Len> | |
1853 | struct __aligned_storage_msa | |
33ac58d5 | 1854 | { |
123c516a PC |
1855 | union __type |
1856 | { | |
1857 | unsigned char __data[_Len]; | |
33ac58d5 | 1858 | struct __attribute__((__aligned__)) { } __align; |
123c516a PC |
1859 | }; |
1860 | }; | |
1861 | ||
1862 | /** | |
1863 | * @brief Alignment type. | |
1864 | * | |
1865 | * The value of _Align is a default-alignment which shall be the | |
1866 | * most stringent alignment requirement for any C++ object type | |
1867 | * whose size is no greater than _Len (3.9). The member typedef | |
1868 | * type shall be a POD type suitable for use as uninitialized | |
1869 | * storage for any object whose size is at most _Len and whose | |
1870 | * alignment is a divisor of _Align. | |
1871 | */ | |
1872 | template<std::size_t _Len, std::size_t _Align = | |
1873 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | |
1874 | struct aligned_storage | |
33ac58d5 | 1875 | { |
123c516a PC |
1876 | union type |
1877 | { | |
1878 | unsigned char __data[_Len]; | |
33ac58d5 | 1879 | struct __attribute__((__aligned__((_Align)))) { } __align; |
123c516a PC |
1880 | }; |
1881 | }; | |
1882 | ||
d3718027 RS |
1883 | template <typename... _Types> |
1884 | struct __strictest_alignment | |
1885 | { | |
1886 | static const size_t _S_alignment = 0; | |
1887 | static const size_t _S_size = 0; | |
1888 | }; | |
1889 | ||
1890 | template <typename _Tp, typename... _Types> | |
1891 | struct __strictest_alignment<_Tp, _Types...> | |
1892 | { | |
1893 | static const size_t _S_alignment = | |
1894 | alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment | |
1895 | ? alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment; | |
1896 | static const size_t _S_size = | |
1897 | sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size | |
1898 | ? sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size; | |
1899 | }; | |
1900 | ||
1901 | /** | |
1902 | * @brief Provide aligned storage for types. | |
1903 | * | |
1904 | * [meta.trans.other] | |
1905 | * | |
1906 | * Provides aligned storage for any of the provided types of at | |
1907 | * least size _Len. | |
1908 | * | |
1909 | * @see aligned_storage | |
1910 | */ | |
1911 | template <size_t _Len, typename... _Types> | |
1912 | struct aligned_union | |
1913 | { | |
1914 | private: | |
1915 | static_assert(sizeof...(_Types) != 0, "At least one type is required"); | |
1916 | ||
1917 | using __strictest = __strictest_alignment<_Types...>; | |
1918 | static const size_t _S_len = _Len > __strictest::_S_size | |
1919 | ? _Len : __strictest::_S_size; | |
1920 | public: | |
1921 | /// The value of the strictest alignment of _Types. | |
1922 | static const size_t alignment_value = __strictest::_S_alignment; | |
1923 | /// The storage. | |
1924 | typedef typename aligned_storage<_S_len, alignment_value>::type type; | |
1925 | }; | |
1926 | ||
1927 | template <size_t _Len, typename... _Types> | |
1928 | const size_t aligned_union<_Len, _Types...>::alignment_value; | |
123c516a PC |
1929 | |
1930 | // Decay trait for arrays and functions, used for perfect forwarding | |
1931 | // in make_pair, make_tuple, etc. | |
33ac58d5 | 1932 | template<typename _Up, |
123c516a | 1933 | bool _IsArray = is_array<_Up>::value, |
33ac58d5 | 1934 | bool _IsFunction = is_function<_Up>::value> |
123c516a PC |
1935 | struct __decay_selector; |
1936 | ||
1937 | // NB: DR 705. | |
33ac58d5 | 1938 | template<typename _Up> |
123c516a PC |
1939 | struct __decay_selector<_Up, false, false> |
1940 | { typedef typename remove_cv<_Up>::type __type; }; | |
1941 | ||
33ac58d5 | 1942 | template<typename _Up> |
123c516a PC |
1943 | struct __decay_selector<_Up, true, false> |
1944 | { typedef typename remove_extent<_Up>::type* __type; }; | |
1945 | ||
33ac58d5 | 1946 | template<typename _Up> |
123c516a PC |
1947 | struct __decay_selector<_Up, false, true> |
1948 | { typedef typename add_pointer<_Up>::type __type; }; | |
1949 | ||
1950 | /// decay | |
33ac58d5 JW |
1951 | template<typename _Tp> |
1952 | class decay | |
1953 | { | |
123c516a PC |
1954 | typedef typename remove_reference<_Tp>::type __remove_type; |
1955 | ||
1956 | public: | |
1957 | typedef typename __decay_selector<__remove_type>::__type type; | |
1958 | }; | |
1959 | ||
1960 | template<typename _Tp> | |
1961 | class reference_wrapper; | |
1962 | ||
1963 | // Helper which adds a reference to a type when given a reference_wrapper | |
1964 | template<typename _Tp> | |
1965 | struct __strip_reference_wrapper | |
1966 | { | |
1967 | typedef _Tp __type; | |
1968 | }; | |
1969 | ||
1970 | template<typename _Tp> | |
1971 | struct __strip_reference_wrapper<reference_wrapper<_Tp> > | |
1972 | { | |
1973 | typedef _Tp& __type; | |
1974 | }; | |
1975 | ||
123c516a PC |
1976 | template<typename _Tp> |
1977 | struct __decay_and_strip | |
1978 | { | |
1979 | typedef typename __strip_reference_wrapper< | |
1980 | typename decay<_Tp>::type>::__type __type; | |
1981 | }; | |
1982 | ||
1983 | ||
123c516a | 1984 | // Primary template. |
13901e4b | 1985 | /// Define a member typedef @c type only if a boolean constant is true. |
123c516a | 1986 | template<bool, typename _Tp = void> |
33ac58d5 | 1987 | struct enable_if |
123c516a PC |
1988 | { }; |
1989 | ||
1990 | // Partial specialization for true. | |
1991 | template<typename _Tp> | |
1992 | struct enable_if<true, _Tp> | |
1993 | { typedef _Tp type; }; | |
1994 | ||
23df8534 JW |
1995 | template<typename... _Cond> |
1996 | using _Require = typename enable_if<__and_<_Cond...>::value>::type; | |
123c516a | 1997 | |
123c516a | 1998 | // Primary template. |
13901e4b | 1999 | /// Define a member typedef @c type to one of two argument types. |
123c516a PC |
2000 | template<bool _Cond, typename _Iftrue, typename _Iffalse> |
2001 | struct conditional | |
2002 | { typedef _Iftrue type; }; | |
2003 | ||
2004 | // Partial specialization for false. | |
2005 | template<typename _Iftrue, typename _Iffalse> | |
2006 | struct conditional<false, _Iftrue, _Iffalse> | |
2007 | { typedef _Iffalse type; }; | |
2008 | ||
5b9daa7e | 2009 | /// common_type |
cfa9a96b CF |
2010 | template<typename... _Tp> |
2011 | struct common_type; | |
2012 | ||
c0ffa2ba | 2013 | // Sfinae-friendly common_type implementation: |
b3618b71 DK |
2014 | |
2015 | struct __do_common_type_impl | |
2016 | { | |
2017 | template<typename _Tp, typename _Up> | |
6c5173c0 | 2018 | static __success_type<typename decay<decltype |
fe4e4e3b | 2019 | (true ? std::declval<_Tp>() |
6c5173c0 | 2020 | : std::declval<_Up>())>::type> _S_test(int); |
b3618b71 DK |
2021 | |
2022 | template<typename, typename> | |
2023 | static __failure_type _S_test(...); | |
2024 | }; | |
2025 | ||
2026 | template<typename _Tp, typename _Up> | |
2027 | struct __common_type_impl | |
2028 | : private __do_common_type_impl | |
2029 | { | |
2030 | typedef decltype(_S_test<_Tp, _Up>(0)) type; | |
2031 | }; | |
2032 | ||
2033 | struct __do_member_type_wrapper | |
2034 | { | |
2035 | template<typename _Tp> | |
2036 | static __success_type<typename _Tp::type> _S_test(int); | |
2037 | ||
2038 | template<typename> | |
2039 | static __failure_type _S_test(...); | |
2040 | }; | |
2041 | ||
2042 | template<typename _Tp> | |
2043 | struct __member_type_wrapper | |
2044 | : private __do_member_type_wrapper | |
2045 | { | |
2046 | typedef decltype(_S_test<_Tp>(0)) type; | |
2047 | }; | |
2048 | ||
2049 | template<typename _CTp, typename... _Args> | |
2050 | struct __expanded_common_type_wrapper | |
2051 | { | |
2052 | typedef common_type<typename _CTp::type, _Args...> type; | |
2053 | }; | |
2054 | ||
2055 | template<typename... _Args> | |
2056 | struct __expanded_common_type_wrapper<__failure_type, _Args...> | |
2057 | { typedef __failure_type type; }; | |
2058 | ||
cfa9a96b CF |
2059 | template<typename _Tp> |
2060 | struct common_type<_Tp> | |
6c5173c0 | 2061 | { typedef typename decay<_Tp>::type type; }; |
cfa9a96b CF |
2062 | |
2063 | template<typename _Tp, typename _Up> | |
7274deff | 2064 | struct common_type<_Tp, _Up> |
b3618b71 DK |
2065 | : public __common_type_impl<_Tp, _Up>::type |
2066 | { }; | |
cfa9a96b CF |
2067 | |
2068 | template<typename _Tp, typename _Up, typename... _Vp> | |
2069 | struct common_type<_Tp, _Up, _Vp...> | |
b3618b71 DK |
2070 | : public __expanded_common_type_wrapper<typename __member_type_wrapper< |
2071 | common_type<_Tp, _Up>>::type, _Vp...>::type | |
2072 | { }; | |
7274deff | 2073 | |
13901e4b | 2074 | /// The underlying type of an enum. |
a47407f6 PC |
2075 | template<typename _Tp> |
2076 | struct underlying_type | |
2077 | { | |
2078 | typedef __underlying_type(_Tp) type; | |
2079 | }; | |
123c516a | 2080 | |
7274deff PC |
2081 | template<typename _Tp> |
2082 | struct __declval_protector | |
2083 | { | |
2084 | static const bool __stop = false; | |
7274deff PC |
2085 | }; |
2086 | ||
2087 | template<typename _Tp> | |
ec26ff5a | 2088 | auto declval() noexcept -> decltype(__declval<_Tp>(0)) |
7274deff PC |
2089 | { |
2090 | static_assert(__declval_protector<_Tp>::__stop, | |
2091 | "declval() must not be used!"); | |
ec26ff5a | 2092 | return __declval<_Tp>(0); |
7274deff | 2093 | } |
1041daba | 2094 | |
be7f7822 JW |
2095 | /// result_of |
2096 | template<typename _Signature> | |
2097 | class result_of; | |
2098 | ||
c0ffa2ba | 2099 | // Sfinae-friendly result_of implementation: |
83ddb39f | 2100 | |
a15f7cb8 ESR |
2101 | #define __cpp_lib_result_of_sfinae 201210 |
2102 | ||
93e95400 JW |
2103 | struct __invoke_memfun_ref { }; |
2104 | struct __invoke_memfun_deref { }; | |
2105 | struct __invoke_memobj_ref { }; | |
2106 | struct __invoke_memobj_deref { }; | |
2107 | struct __invoke_other { }; | |
2108 | ||
2109 | // Associate a tag type with a specialization of __success_type. | |
2110 | template<typename _Tp, typename _Tag> | |
2111 | struct __result_of_success : __success_type<_Tp> | |
2112 | { using __invoke_type = _Tag; }; | |
2113 | ||
83ddb39f DK |
2114 | // [func.require] paragraph 1 bullet 1: |
2115 | struct __result_of_memfun_ref_impl | |
2116 | { | |
2117 | template<typename _Fp, typename _Tp1, typename... _Args> | |
93e95400 | 2118 | static __result_of_success<decltype( |
83ddb39f | 2119 | (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...) |
93e95400 | 2120 | ), __invoke_memfun_ref> _S_test(int); |
83ddb39f DK |
2121 | |
2122 | template<typename...> | |
2123 | static __failure_type _S_test(...); | |
2124 | }; | |
2125 | ||
2126 | template<typename _MemPtr, typename _Arg, typename... _Args> | |
2127 | struct __result_of_memfun_ref | |
2128 | : private __result_of_memfun_ref_impl | |
2129 | { | |
2130 | typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type; | |
2131 | }; | |
2132 | ||
2133 | // [func.require] paragraph 1 bullet 2: | |
2134 | struct __result_of_memfun_deref_impl | |
2135 | { | |
2136 | template<typename _Fp, typename _Tp1, typename... _Args> | |
93e95400 | 2137 | static __result_of_success<decltype( |
83ddb39f | 2138 | ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...) |
93e95400 | 2139 | ), __invoke_memfun_deref> _S_test(int); |
83ddb39f DK |
2140 | |
2141 | template<typename...> | |
2142 | static __failure_type _S_test(...); | |
2143 | }; | |
2144 | ||
2145 | template<typename _MemPtr, typename _Arg, typename... _Args> | |
2146 | struct __result_of_memfun_deref | |
2147 | : private __result_of_memfun_deref_impl | |
2148 | { | |
2149 | typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type; | |
2150 | }; | |
2151 | ||
2152 | // [func.require] paragraph 1 bullet 3: | |
2153 | struct __result_of_memobj_ref_impl | |
2154 | { | |
2155 | template<typename _Fp, typename _Tp1> | |
93e95400 | 2156 | static __result_of_success<decltype( |
83ddb39f | 2157 | std::declval<_Tp1>().*std::declval<_Fp>() |
93e95400 | 2158 | ), __invoke_memobj_ref> _S_test(int); |
83ddb39f DK |
2159 | |
2160 | template<typename, typename> | |
2161 | static __failure_type _S_test(...); | |
2162 | }; | |
2163 | ||
2164 | template<typename _MemPtr, typename _Arg> | |
2165 | struct __result_of_memobj_ref | |
2166 | : private __result_of_memobj_ref_impl | |
2167 | { | |
2168 | typedef decltype(_S_test<_MemPtr, _Arg>(0)) type; | |
2169 | }; | |
2170 | ||
2171 | // [func.require] paragraph 1 bullet 4: | |
2172 | struct __result_of_memobj_deref_impl | |
2173 | { | |
2174 | template<typename _Fp, typename _Tp1> | |
93e95400 | 2175 | static __result_of_success<decltype( |
83ddb39f | 2176 | (*std::declval<_Tp1>()).*std::declval<_Fp>() |
93e95400 | 2177 | ), __invoke_memobj_deref> _S_test(int); |
83ddb39f DK |
2178 | |
2179 | template<typename, typename> | |
2180 | static __failure_type _S_test(...); | |
2181 | }; | |
2182 | ||
be7f7822 | 2183 | template<typename _MemPtr, typename _Arg> |
83ddb39f DK |
2184 | struct __result_of_memobj_deref |
2185 | : private __result_of_memobj_deref_impl | |
2186 | { | |
2187 | typedef decltype(_S_test<_MemPtr, _Arg>(0)) type; | |
2188 | }; | |
2189 | ||
2190 | template<typename _MemPtr, typename _Arg> | |
2191 | struct __result_of_memobj; | |
be7f7822 JW |
2192 | |
2193 | template<typename _Res, typename _Class, typename _Arg> | |
83ddb39f | 2194 | struct __result_of_memobj<_Res _Class::*, _Arg> |
be7f7822 | 2195 | { |
83ddb39f DK |
2196 | typedef typename remove_cv<typename remove_reference< |
2197 | _Arg>::type>::type _Argval; | |
2198 | typedef _Res _Class::* _MemPtr; | |
2199 | typedef typename conditional<__or_<is_same<_Argval, _Class>, | |
2200 | is_base_of<_Class, _Argval>>::value, | |
2201 | __result_of_memobj_ref<_MemPtr, _Arg>, | |
2202 | __result_of_memobj_deref<_MemPtr, _Arg> | |
2203 | >::type::type type; | |
be7f7822 JW |
2204 | }; |
2205 | ||
83ddb39f DK |
2206 | template<typename _MemPtr, typename _Arg, typename... _Args> |
2207 | struct __result_of_memfun; | |
be7f7822 JW |
2208 | |
2209 | template<typename _Res, typename _Class, typename _Arg, typename... _Args> | |
83ddb39f | 2210 | struct __result_of_memfun<_Res _Class::*, _Arg, _Args...> |
be7f7822 | 2211 | { |
83ddb39f DK |
2212 | typedef typename remove_cv<typename remove_reference< |
2213 | _Arg>::type>::type _Argval; | |
2214 | typedef _Res _Class::* _MemPtr; | |
2215 | typedef typename conditional<__or_<is_same<_Argval, _Class>, | |
2216 | is_base_of<_Class, _Argval>>::value, | |
2217 | __result_of_memfun_ref<_MemPtr, _Arg, _Args...>, | |
2218 | __result_of_memfun_deref<_MemPtr, _Arg, _Args...> | |
2219 | >::type::type type; | |
be7f7822 JW |
2220 | }; |
2221 | ||
93e95400 JW |
2222 | // _GLIBCXX_RESOLVE_LIB_DEFECTS |
2223 | // 2219. INVOKE-ing a pointer to member with a reference_wrapper | |
2224 | // as the object expression | |
93e95400 | 2225 | |
7dcc645c JW |
2226 | // Used by result_of, invoke etc. to unwrap a reference_wrapper. |
2227 | template<typename _Tp, typename _Up = typename decay<_Tp>::type> | |
2228 | struct __inv_unwrap | |
2229 | { | |
2230 | using type = _Tp; | |
2231 | }; | |
f3d7dd52 | 2232 | |
7dcc645c JW |
2233 | template<typename _Tp, typename _Up> |
2234 | struct __inv_unwrap<_Tp, reference_wrapper<_Up>> | |
2235 | { | |
2236 | using type = _Up&; | |
2237 | }; | |
93e95400 | 2238 | |
be7f7822 | 2239 | template<bool, bool, typename _Functor, typename... _ArgTypes> |
83ddb39f | 2240 | struct __result_of_impl |
be7f7822 | 2241 | { |
83ddb39f | 2242 | typedef __failure_type type; |
be7f7822 JW |
2243 | }; |
2244 | ||
2245 | template<typename _MemPtr, typename _Arg> | |
83ddb39f | 2246 | struct __result_of_impl<true, false, _MemPtr, _Arg> |
7dcc645c JW |
2247 | : public __result_of_memobj<typename decay<_MemPtr>::type, |
2248 | typename __inv_unwrap<_Arg>::type> | |
c4db9a77 | 2249 | { }; |
be7f7822 | 2250 | |
83ddb39f DK |
2251 | template<typename _MemPtr, typename _Arg, typename... _Args> |
2252 | struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...> | |
7dcc645c JW |
2253 | : public __result_of_memfun<typename decay<_MemPtr>::type, |
2254 | typename __inv_unwrap<_Arg>::type, _Args...> | |
c4db9a77 | 2255 | { }; |
be7f7822 | 2256 | |
83ddb39f DK |
2257 | // [func.require] paragraph 1 bullet 5: |
2258 | struct __result_of_other_impl | |
2259 | { | |
2260 | template<typename _Fn, typename... _Args> | |
93e95400 | 2261 | static __result_of_success<decltype( |
83ddb39f | 2262 | std::declval<_Fn>()(std::declval<_Args>()...) |
93e95400 | 2263 | ), __invoke_other> _S_test(int); |
83ddb39f DK |
2264 | |
2265 | template<typename...> | |
2266 | static __failure_type _S_test(...); | |
2267 | }; | |
2268 | ||
be7f7822 | 2269 | template<typename _Functor, typename... _ArgTypes> |
83ddb39f DK |
2270 | struct __result_of_impl<false, false, _Functor, _ArgTypes...> |
2271 | : private __result_of_other_impl | |
be7f7822 | 2272 | { |
83ddb39f | 2273 | typedef decltype(_S_test<_Functor, _ArgTypes...>(0)) type; |
be7f7822 JW |
2274 | }; |
2275 | ||
7dcc645c | 2276 | // __invoke_result (std::invoke_result for C++11) |
83ddb39f | 2277 | template<typename _Functor, typename... _ArgTypes> |
7dcc645c | 2278 | struct __invoke_result |
83ddb39f DK |
2279 | : public __result_of_impl< |
2280 | is_member_object_pointer< | |
2281 | typename remove_reference<_Functor>::type | |
2282 | >::value, | |
2283 | is_member_function_pointer< | |
2284 | typename remove_reference<_Functor>::type | |
2285 | >::value, | |
7dcc645c | 2286 | _Functor, _ArgTypes... |
83ddb39f DK |
2287 | >::type |
2288 | { }; | |
c0ffa2ba | 2289 | |
7dcc645c JW |
2290 | template<typename _Functor, typename... _ArgTypes> |
2291 | struct result_of<_Functor(_ArgTypes...)> | |
2292 | : public __invoke_result<_Functor, _ArgTypes...> | |
2293 | { }; | |
2294 | ||
4457e88c JW |
2295 | #if __cplusplus > 201103L |
2296 | /// Alias template for aligned_storage | |
2297 | template<size_t _Len, size_t _Align = | |
2298 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | |
2299 | using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; | |
2300 | ||
d3718027 RS |
2301 | template <size_t _Len, typename... _Types> |
2302 | using aligned_union_t = typename aligned_union<_Len, _Types...>::type; | |
2303 | ||
4457e88c JW |
2304 | /// Alias template for decay |
2305 | template<typename _Tp> | |
2306 | using decay_t = typename decay<_Tp>::type; | |
2307 | ||
2308 | /// Alias template for enable_if | |
2309 | template<bool _Cond, typename _Tp = void> | |
2310 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | |
2311 | ||
2312 | /// Alias template for conditional | |
2313 | template<bool _Cond, typename _Iftrue, typename _Iffalse> | |
2314 | using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type; | |
2315 | ||
2316 | /// Alias template for common_type | |
2317 | template<typename... _Tp> | |
2318 | using common_type_t = typename common_type<_Tp...>::type; | |
2319 | ||
2320 | /// Alias template for underlying_type | |
2321 | template<typename _Tp> | |
2322 | using underlying_type_t = typename underlying_type<_Tp>::type; | |
2323 | ||
2324 | /// Alias template for result_of | |
2325 | template<typename _Tp> | |
2326 | using result_of_t = typename result_of<_Tp>::type; | |
2327 | #endif | |
2328 | ||
847e9cf8 JW |
2329 | template<typename...> using __void_t = void; |
2330 | ||
bd1eb5e0 JW |
2331 | #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 |
2332 | #define __cpp_lib_void_t 201411 | |
2333 | /// A metafunction that always yields void, used for detecting valid types. | |
2334 | template<typename...> using void_t = void; | |
2335 | #endif | |
2336 | ||
6af6bef4 JW |
2337 | /// Implementation of the detection idiom (negative case). |
2338 | template<typename _Default, typename _AlwaysVoid, | |
2339 | template<typename...> class _Op, typename... _Args> | |
2340 | struct __detector | |
2341 | { | |
2342 | using value_t = false_type; | |
2343 | using type = _Default; | |
2344 | }; | |
2345 | ||
2346 | /// Implementation of the detection idiom (positive case). | |
2347 | template<typename _Default, template<typename...> class _Op, | |
2348 | typename... _Args> | |
2349 | struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...> | |
2350 | { | |
2351 | using value_t = true_type; | |
2352 | using type = _Op<_Args...>; | |
2353 | }; | |
2354 | ||
2355 | // Detect whether _Op<_Args...> is a valid type, use _Default if not. | |
2356 | template<typename _Default, template<typename...> class _Op, | |
2357 | typename... _Args> | |
2358 | using __detected_or = __detector<_Default, void, _Op, _Args...>; | |
2359 | ||
2360 | // _Op<_Args...> if that is a valid type, otherwise _Default. | |
2361 | template<typename _Default, template<typename...> class _Op, | |
2362 | typename... _Args> | |
2363 | using __detected_or_t | |
2364 | = typename __detected_or<_Default, _Op, _Args...>::type; | |
2365 | ||
c0ffa2ba | 2366 | /// @} group metaprogramming |
847e9cf8 | 2367 | |
033b71ce PC |
2368 | /** |
2369 | * Use SFINAE to determine if the type _Tp has a publicly-accessible | |
2370 | * member type _NTYPE. | |
2371 | */ | |
82b12c4b | 2372 | #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \ |
847e9cf8 | 2373 | template<typename _Tp, typename = __void_t<>> \ |
82b12c4b | 2374 | struct __has_##_NTYPE \ |
847e9cf8 JW |
2375 | : false_type \ |
2376 | { }; \ | |
2377 | template<typename _Tp> \ | |
2378 | struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \ | |
2379 | : true_type \ | |
033b71ce PC |
2380 | { }; |
2381 | ||
26b5ace7 DK |
2382 | template <typename _Tp> |
2383 | struct __is_swappable; | |
ddb63209 | 2384 | |
26b5ace7 DK |
2385 | template <typename _Tp> |
2386 | struct __is_nothrow_swappable; | |
ddb63209 | 2387 | |
a2863bde VV |
2388 | template<typename... _Elements> |
2389 | class tuple; | |
2390 | ||
2391 | template<typename> | |
2392 | struct __is_tuple_like_impl : false_type | |
2393 | { }; | |
2394 | ||
2395 | template<typename... _Tps> | |
2396 | struct __is_tuple_like_impl<tuple<_Tps...>> : true_type | |
2397 | { }; | |
2398 | ||
2399 | // Internal type trait that allows us to sfinae-protect tuple_cat. | |
2400 | template<typename _Tp> | |
2401 | struct __is_tuple_like | |
2402 | : public __is_tuple_like_impl<typename remove_cv< | |
2403 | typename remove_reference<_Tp>::type>::type>::type | |
2404 | { }; | |
2405 | ||
ddb63209 VV |
2406 | template<typename _Tp> |
2407 | inline | |
a2863bde VV |
2408 | typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>, |
2409 | is_move_constructible<_Tp>, | |
ddb63209 VV |
2410 | is_move_assignable<_Tp>>::value>::type |
2411 | swap(_Tp&, _Tp&) | |
2412 | noexcept(__and_<is_nothrow_move_constructible<_Tp>, | |
2413 | is_nothrow_move_assignable<_Tp>>::value); | |
2414 | ||
2415 | template<typename _Tp, size_t _Nm> | |
2416 | inline | |
26b5ace7 | 2417 | typename enable_if<__is_swappable<_Tp>::value>::type |
ddb63209 | 2418 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) |
26b5ace7 | 2419 | noexcept(__is_nothrow_swappable<_Tp>::value); |
ddb63209 | 2420 | |
26b5ace7 | 2421 | namespace __swappable_details { |
ddb63209 VV |
2422 | using std::swap; |
2423 | ||
26b5ace7 DK |
2424 | struct __do_is_swappable_impl |
2425 | { | |
2426 | template<typename _Tp, typename | |
2427 | = decltype(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))> | |
2428 | static true_type __test(int); | |
2429 | ||
2430 | template<typename> | |
2431 | static false_type __test(...); | |
2432 | }; | |
2433 | ||
2434 | struct __do_is_nothrow_swappable_impl | |
2435 | { | |
2436 | template<typename _Tp> | |
2437 | static __bool_constant< | |
2438 | noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>())) | |
2439 | > __test(int); | |
2440 | ||
2441 | template<typename> | |
2442 | static false_type __test(...); | |
2443 | }; | |
2444 | ||
6b9539e2 | 2445 | } // namespace __swappable_details |
ddb63209 | 2446 | |
26b5ace7 DK |
2447 | template<typename _Tp> |
2448 | struct __is_swappable_impl | |
2449 | : public __swappable_details::__do_is_swappable_impl | |
2450 | { | |
2451 | typedef decltype(__test<_Tp>(0)) type; | |
2452 | }; | |
2453 | ||
2454 | template<typename _Tp> | |
ddb63209 | 2455 | struct __is_nothrow_swappable_impl |
26b5ace7 DK |
2456 | : public __swappable_details::__do_is_nothrow_swappable_impl |
2457 | { | |
2458 | typedef decltype(__test<_Tp>(0)) type; | |
2459 | }; | |
ddb63209 | 2460 | |
26b5ace7 DK |
2461 | template<typename _Tp> |
2462 | struct __is_swappable | |
2463 | : public __is_swappable_impl<_Tp>::type | |
ddb63209 VV |
2464 | { }; |
2465 | ||
26b5ace7 | 2466 | template<typename _Tp> |
ddb63209 | 2467 | struct __is_nothrow_swappable |
26b5ace7 | 2468 | : public __is_nothrow_swappable_impl<_Tp>::type |
ddb63209 VV |
2469 | { }; |
2470 | ||
6b9539e2 DK |
2471 | #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 |
2472 | #define __cpp_lib_is_swappable 201603 | |
2473 | /// Metafunctions used for detecting swappable types: p0185r1 | |
2474 | ||
2475 | /// is_swappable | |
2476 | template<typename _Tp> | |
2477 | struct is_swappable | |
2478 | : public __is_swappable_impl<_Tp>::type | |
2479 | { }; | |
2480 | ||
2481 | /// is_nothrow_swappable | |
2482 | template<typename _Tp> | |
2483 | struct is_nothrow_swappable | |
2484 | : public __is_nothrow_swappable_impl<_Tp>::type | |
2485 | { }; | |
2486 | ||
2487 | #if __cplusplus >= 201402L | |
2488 | /// is_swappable_v | |
2489 | template<typename _Tp> | |
288695f7 DK |
2490 | _GLIBCXX17_INLINE constexpr bool is_swappable_v = |
2491 | is_swappable<_Tp>::value; | |
6b9539e2 DK |
2492 | |
2493 | /// is_nothrow_swappable_v | |
2494 | template<typename _Tp> | |
288695f7 DK |
2495 | _GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_v = |
2496 | is_nothrow_swappable<_Tp>::value; | |
6b9539e2 DK |
2497 | #endif // __cplusplus >= 201402L |
2498 | ||
2499 | namespace __swappable_with_details { | |
2500 | using std::swap; | |
2501 | ||
2502 | struct __do_is_swappable_with_impl | |
2503 | { | |
2504 | template<typename _Tp, typename _Up, typename | |
2505 | = decltype(swap(std::declval<_Tp>(), std::declval<_Up>())), | |
2506 | typename | |
2507 | = decltype(swap(std::declval<_Up>(), std::declval<_Tp>()))> | |
2508 | static true_type __test(int); | |
2509 | ||
2510 | template<typename, typename> | |
2511 | static false_type __test(...); | |
2512 | }; | |
2513 | ||
2514 | struct __do_is_nothrow_swappable_with_impl | |
2515 | { | |
2516 | template<typename _Tp, typename _Up> | |
2517 | static __bool_constant< | |
2518 | noexcept(swap(std::declval<_Tp>(), std::declval<_Up>())) | |
2519 | && | |
2520 | noexcept(swap(std::declval<_Up>(), std::declval<_Tp>())) | |
2521 | > __test(int); | |
2522 | ||
2523 | template<typename, typename> | |
2524 | static false_type __test(...); | |
2525 | }; | |
2526 | ||
2527 | } // namespace __swappable_with_details | |
2528 | ||
2529 | template<typename _Tp, typename _Up> | |
2530 | struct __is_swappable_with_impl | |
2531 | : public __swappable_with_details::__do_is_swappable_with_impl | |
2532 | { | |
2533 | typedef decltype(__test<_Tp, _Up>(0)) type; | |
2534 | }; | |
2535 | ||
2536 | // Optimization for the homogenous lvalue case, not required: | |
2537 | template<typename _Tp> | |
2538 | struct __is_swappable_with_impl<_Tp&, _Tp&> | |
2539 | : public __swappable_details::__do_is_swappable_impl | |
2540 | { | |
2541 | typedef decltype(__test<_Tp&>(0)) type; | |
2542 | }; | |
2543 | ||
2544 | template<typename _Tp, typename _Up> | |
2545 | struct __is_nothrow_swappable_with_impl | |
2546 | : public __swappable_with_details::__do_is_nothrow_swappable_with_impl | |
2547 | { | |
2548 | typedef decltype(__test<_Tp, _Up>(0)) type; | |
2549 | }; | |
2550 | ||
2551 | // Optimization for the homogenous lvalue case, not required: | |
2552 | template<typename _Tp> | |
2553 | struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&> | |
2554 | : public __swappable_details::__do_is_nothrow_swappable_impl | |
2555 | { | |
2556 | typedef decltype(__test<_Tp&>(0)) type; | |
2557 | }; | |
2558 | ||
2559 | /// is_swappable_with | |
2560 | template<typename _Tp, typename _Up> | |
2561 | struct is_swappable_with | |
2562 | : public __is_swappable_with_impl<_Tp, _Up>::type | |
2563 | { }; | |
2564 | ||
2565 | /// is_nothrow_swappable_with | |
2566 | template<typename _Tp, typename _Up> | |
2567 | struct is_nothrow_swappable_with | |
2568 | : public __is_nothrow_swappable_with_impl<_Tp, _Up>::type | |
2569 | { }; | |
2570 | ||
2571 | #if __cplusplus >= 201402L | |
2572 | /// is_swappable_with_v | |
2573 | template<typename _Tp, typename _Up> | |
288695f7 DK |
2574 | _GLIBCXX17_INLINE constexpr bool is_swappable_with_v = |
2575 | is_swappable_with<_Tp, _Up>::value; | |
6b9539e2 DK |
2576 | |
2577 | /// is_nothrow_swappable_with_v | |
2578 | template<typename _Tp, typename _Up> | |
288695f7 | 2579 | _GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_with_v = |
6b9539e2 DK |
2580 | is_nothrow_swappable_with<_Tp, _Up>::value; |
2581 | #endif // __cplusplus >= 201402L | |
137422c8 | 2582 | |
42183d03 JW |
2583 | #endif// c++1z or gnu++11 |
2584 | ||
7dcc645c | 2585 | // __is_invocable (std::is_invocable for C++11) |
42183d03 | 2586 | |
7dcc645c JW |
2587 | template<typename _Result, typename _Ret, typename = void> |
2588 | struct __is_invocable_impl : false_type { }; | |
42183d03 JW |
2589 | |
2590 | template<typename _Result, typename _Ret> | |
7dcc645c | 2591 | struct __is_invocable_impl<_Result, _Ret, __void_t<typename _Result::type>> |
91d01b33 | 2592 | : __or_<is_void<_Ret>, is_convertible<typename _Result::type, _Ret>>::type |
42183d03 JW |
2593 | { }; |
2594 | ||
7dcc645c JW |
2595 | template<typename _Fn, typename... _ArgTypes> |
2596 | struct __is_invocable | |
2597 | : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type | |
42183d03 JW |
2598 | { }; |
2599 | ||
42183d03 JW |
2600 | template<typename _Fn, typename _Tp, typename... _Args> |
2601 | constexpr bool __call_is_nt(__invoke_memfun_ref) | |
2602 | { | |
2603 | using _Up = typename __inv_unwrap<_Tp>::type; | |
2604 | return noexcept((std::declval<_Up>().*std::declval<_Fn>())( | |
2605 | std::declval<_Args>()...)); | |
2606 | } | |
2607 | ||
2608 | template<typename _Fn, typename _Tp, typename... _Args> | |
2609 | constexpr bool __call_is_nt(__invoke_memfun_deref) | |
2610 | { | |
2611 | return noexcept(((*std::declval<_Tp>()).*std::declval<_Fn>())( | |
2612 | std::declval<_Args>()...)); | |
2613 | } | |
2614 | ||
2615 | template<typename _Fn, typename _Tp> | |
2616 | constexpr bool __call_is_nt(__invoke_memobj_ref) | |
2617 | { | |
2618 | using _Up = typename __inv_unwrap<_Tp>::type; | |
2619 | return noexcept(std::declval<_Up>().*std::declval<_Fn>()); | |
2620 | } | |
2621 | ||
2622 | template<typename _Fn, typename _Tp> | |
2623 | constexpr bool __call_is_nt(__invoke_memobj_deref) | |
2624 | { | |
2625 | return noexcept((*std::declval<_Tp>()).*std::declval<_Fn>()); | |
2626 | } | |
2627 | ||
2628 | template<typename _Fn, typename... _Args> | |
2629 | constexpr bool __call_is_nt(__invoke_other) | |
2630 | { | |
2631 | return noexcept(std::declval<_Fn>()(std::declval<_Args>()...)); | |
2632 | } | |
2633 | ||
7dcc645c | 2634 | template<typename _Result, typename _Fn, typename... _Args> |
42183d03 JW |
2635 | struct __call_is_nothrow |
2636 | : __bool_constant< | |
7dcc645c JW |
2637 | std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{}) |
2638 | > | |
42183d03 JW |
2639 | { }; |
2640 | ||
7dcc645c JW |
2641 | template<typename _Fn, typename... _Args> |
2642 | using __call_is_nothrow_ | |
2643 | = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>; | |
42183d03 | 2644 | |
7dcc645c JW |
2645 | // __is_nothrow_invocable (std::is_nothrow_invocable for C++11) |
2646 | template<typename _Fn, typename... _Args> | |
2647 | struct __is_nothrow_invocable | |
2648 | : __and_<__is_invocable<_Fn, _Args...>, | |
2649 | __call_is_nothrow_<_Fn, _Args...>>::type | |
42183d03 JW |
2650 | { }; |
2651 | ||
f524d5b3 VV |
2652 | struct __nonesuch { |
2653 | __nonesuch() = delete; | |
2654 | ~__nonesuch() = delete; | |
2655 | __nonesuch(__nonesuch const&) = delete; | |
2656 | void operator=(__nonesuch const&) = delete; | |
2657 | }; | |
2658 | ||
e641ee43 | 2659 | #if __cplusplus >= 201703L |
7dcc645c JW |
2660 | # define __cpp_lib_is_invocable 201703 |
2661 | ||
2662 | /// std::invoke_result | |
2663 | template<typename _Functor, typename... _ArgTypes> | |
2664 | struct invoke_result | |
2665 | : public __invoke_result<_Functor, _ArgTypes...> | |
2666 | { }; | |
2667 | ||
2668 | /// std::invoke_result_t | |
2669 | template<typename _Fn, typename... _Args> | |
2670 | using invoke_result_t = typename invoke_result<_Fn, _Args...>::type; | |
42183d03 | 2671 | |
7dcc645c JW |
2672 | /// std::is_invocable |
2673 | template<typename _Fn, typename... _ArgTypes> | |
2674 | struct is_invocable | |
2675 | : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type | |
2676 | { }; | |
42183d03 | 2677 | |
7dcc645c JW |
2678 | /// std::is_invocable_r |
2679 | template<typename _Ret, typename _Fn, typename... _ArgTypes> | |
2680 | struct is_invocable_r | |
2681 | : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type | |
42183d03 JW |
2682 | { }; |
2683 | ||
7dcc645c JW |
2684 | /// std::is_nothrow_invocable |
2685 | template<typename _Fn, typename... _ArgTypes> | |
2686 | struct is_nothrow_invocable | |
2687 | : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>, | |
2688 | __call_is_nothrow_<_Fn, _ArgTypes...>>::type | |
2689 | { }; | |
42183d03 | 2690 | |
c4b06e7f JW |
2691 | template<typename _Result, typename _Ret, typename = void> |
2692 | struct __is_nt_invocable_impl : false_type { }; | |
2693 | ||
2694 | template<typename _Result, typename _Ret> | |
2695 | struct __is_nt_invocable_impl<_Result, _Ret, | |
2696 | __void_t<typename _Result::type>> | |
91d01b33 JW |
2697 | : __or_<is_void<_Ret>, |
2698 | __and_<is_convertible<typename _Result::type, _Ret>, | |
2699 | is_nothrow_constructible<_Ret, typename _Result::type>>> | |
c4b06e7f JW |
2700 | { }; |
2701 | ||
7dcc645c JW |
2702 | /// std::is_nothrow_invocable_r |
2703 | template<typename _Ret, typename _Fn, typename... _ArgTypes> | |
2704 | struct is_nothrow_invocable_r | |
c4b06e7f | 2705 | : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>, |
7dcc645c | 2706 | __call_is_nothrow_<_Fn, _ArgTypes...>>::type |
42183d03 JW |
2707 | { }; |
2708 | ||
7dcc645c JW |
2709 | /// std::is_invocable_v |
2710 | template<typename _Fn, typename... _Args> | |
2711 | inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value; | |
42183d03 | 2712 | |
7dcc645c JW |
2713 | /// std::is_nothrow_invocable_v |
2714 | template<typename _Fn, typename... _Args> | |
2715 | inline constexpr bool is_nothrow_invocable_v | |
2716 | = is_nothrow_invocable<_Fn, _Args...>::value; | |
42183d03 | 2717 | |
7dcc645c JW |
2718 | /// std::is_invocable_r_v |
2719 | template<typename _Fn, typename... _Args> | |
2720 | inline constexpr bool is_invocable_r_v | |
2721 | = is_invocable_r<_Fn, _Args...>::value; | |
2722 | ||
2723 | /// std::is_nothrow_invocable_r_v | |
2724 | template<typename _Fn, typename... _Args> | |
2725 | inline constexpr bool is_nothrow_invocable_r_v | |
2726 | = is_nothrow_invocable_r<_Fn, _Args...>::value; | |
2727 | #endif // C++17 | |
42183d03 | 2728 | |
e641ee43 | 2729 | #if __cplusplus >= 201703L |
068c8ac1 | 2730 | # define __cpp_lib_type_trait_variable_templates 201510L |
137422c8 | 2731 | template <typename _Tp> |
288695f7 | 2732 | inline constexpr bool is_void_v = is_void<_Tp>::value; |
137422c8 | 2733 | template <typename _Tp> |
288695f7 | 2734 | inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; |
137422c8 | 2735 | template <typename _Tp> |
288695f7 | 2736 | inline constexpr bool is_integral_v = is_integral<_Tp>::value; |
137422c8 | 2737 | template <typename _Tp> |
288695f7 | 2738 | inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; |
137422c8 | 2739 | template <typename _Tp> |
288695f7 | 2740 | inline constexpr bool is_array_v = is_array<_Tp>::value; |
137422c8 | 2741 | template <typename _Tp> |
288695f7 | 2742 | inline constexpr bool is_pointer_v = is_pointer<_Tp>::value; |
137422c8 | 2743 | template <typename _Tp> |
288695f7 DK |
2744 | inline constexpr bool is_lvalue_reference_v = |
2745 | is_lvalue_reference<_Tp>::value; | |
137422c8 | 2746 | template <typename _Tp> |
288695f7 DK |
2747 | inline constexpr bool is_rvalue_reference_v = |
2748 | is_rvalue_reference<_Tp>::value; | |
137422c8 | 2749 | template <typename _Tp> |
288695f7 | 2750 | inline constexpr bool is_member_object_pointer_v = |
137422c8 VV |
2751 | is_member_object_pointer<_Tp>::value; |
2752 | template <typename _Tp> | |
288695f7 | 2753 | inline constexpr bool is_member_function_pointer_v = |
137422c8 VV |
2754 | is_member_function_pointer<_Tp>::value; |
2755 | template <typename _Tp> | |
288695f7 | 2756 | inline constexpr bool is_enum_v = is_enum<_Tp>::value; |
137422c8 | 2757 | template <typename _Tp> |
288695f7 | 2758 | inline constexpr bool is_union_v = is_union<_Tp>::value; |
137422c8 | 2759 | template <typename _Tp> |
288695f7 | 2760 | inline constexpr bool is_class_v = is_class<_Tp>::value; |
137422c8 | 2761 | template <typename _Tp> |
288695f7 | 2762 | inline constexpr bool is_function_v = is_function<_Tp>::value; |
137422c8 | 2763 | template <typename _Tp> |
288695f7 | 2764 | inline constexpr bool is_reference_v = is_reference<_Tp>::value; |
137422c8 | 2765 | template <typename _Tp> |
288695f7 | 2766 | inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; |
137422c8 | 2767 | template <typename _Tp> |
288695f7 | 2768 | inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; |
137422c8 | 2769 | template <typename _Tp> |
288695f7 | 2770 | inline constexpr bool is_object_v = is_object<_Tp>::value; |
137422c8 | 2771 | template <typename _Tp> |
288695f7 | 2772 | inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; |
137422c8 | 2773 | template <typename _Tp> |
288695f7 | 2774 | inline constexpr bool is_compound_v = is_compound<_Tp>::value; |
137422c8 | 2775 | template <typename _Tp> |
288695f7 | 2776 | inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; |
137422c8 | 2777 | template <typename _Tp> |
288695f7 | 2778 | inline constexpr bool is_const_v = is_const<_Tp>::value; |
137422c8 | 2779 | template <typename _Tp> |
288695f7 | 2780 | inline constexpr bool is_volatile_v = is_volatile<_Tp>::value; |
137422c8 | 2781 | template <typename _Tp> |
288695f7 | 2782 | inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; |
137422c8 | 2783 | template <typename _Tp> |
288695f7 DK |
2784 | inline constexpr bool is_trivially_copyable_v = |
2785 | is_trivially_copyable<_Tp>::value; | |
137422c8 | 2786 | template <typename _Tp> |
288695f7 | 2787 | inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; |
137422c8 | 2788 | template <typename _Tp> |
288695f7 | 2789 | inline constexpr bool is_pod_v = is_pod<_Tp>::value; |
137422c8 | 2790 | template <typename _Tp> |
288695f7 | 2791 | inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; |
137422c8 | 2792 | template <typename _Tp> |
288695f7 | 2793 | inline constexpr bool is_empty_v = is_empty<_Tp>::value; |
137422c8 | 2794 | template <typename _Tp> |
288695f7 | 2795 | inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value; |
137422c8 | 2796 | template <typename _Tp> |
288695f7 | 2797 | inline constexpr bool is_abstract_v = is_abstract<_Tp>::value; |
137422c8 | 2798 | template <typename _Tp> |
288695f7 | 2799 | inline constexpr bool is_final_v = is_final<_Tp>::value; |
137422c8 | 2800 | template <typename _Tp> |
288695f7 | 2801 | inline constexpr bool is_signed_v = is_signed<_Tp>::value; |
137422c8 | 2802 | template <typename _Tp> |
288695f7 | 2803 | inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; |
137422c8 | 2804 | template <typename _Tp, typename... _Args> |
288695f7 DK |
2805 | inline constexpr bool is_constructible_v = |
2806 | is_constructible<_Tp, _Args...>::value; | |
137422c8 | 2807 | template <typename _Tp> |
288695f7 | 2808 | inline constexpr bool is_default_constructible_v = |
137422c8 VV |
2809 | is_default_constructible<_Tp>::value; |
2810 | template <typename _Tp> | |
288695f7 DK |
2811 | inline constexpr bool is_copy_constructible_v = |
2812 | is_copy_constructible<_Tp>::value; | |
137422c8 | 2813 | template <typename _Tp> |
288695f7 DK |
2814 | inline constexpr bool is_move_constructible_v = |
2815 | is_move_constructible<_Tp>::value; | |
137422c8 | 2816 | template <typename _Tp, typename _Up> |
288695f7 | 2817 | inline constexpr bool is_assignable_v = is_assignable<_Tp, _Up>::value; |
137422c8 | 2818 | template <typename _Tp> |
288695f7 | 2819 | inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; |
137422c8 | 2820 | template <typename _Tp> |
288695f7 | 2821 | inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; |
137422c8 | 2822 | template <typename _Tp> |
288695f7 | 2823 | inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; |
137422c8 | 2824 | template <typename _Tp, typename... _Args> |
288695f7 | 2825 | inline constexpr bool is_trivially_constructible_v = |
137422c8 VV |
2826 | is_trivially_constructible<_Tp, _Args...>::value; |
2827 | template <typename _Tp> | |
288695f7 | 2828 | inline constexpr bool is_trivially_default_constructible_v = |
137422c8 VV |
2829 | is_trivially_default_constructible<_Tp>::value; |
2830 | template <typename _Tp> | |
288695f7 | 2831 | inline constexpr bool is_trivially_copy_constructible_v = |
137422c8 VV |
2832 | is_trivially_copy_constructible<_Tp>::value; |
2833 | template <typename _Tp> | |
288695f7 | 2834 | inline constexpr bool is_trivially_move_constructible_v = |
137422c8 VV |
2835 | is_trivially_move_constructible<_Tp>::value; |
2836 | template <typename _Tp, typename _Up> | |
288695f7 | 2837 | inline constexpr bool is_trivially_assignable_v = |
137422c8 VV |
2838 | is_trivially_assignable<_Tp, _Up>::value; |
2839 | template <typename _Tp> | |
288695f7 | 2840 | inline constexpr bool is_trivially_copy_assignable_v = |
137422c8 VV |
2841 | is_trivially_copy_assignable<_Tp>::value; |
2842 | template <typename _Tp> | |
288695f7 | 2843 | inline constexpr bool is_trivially_move_assignable_v = |
137422c8 VV |
2844 | is_trivially_move_assignable<_Tp>::value; |
2845 | template <typename _Tp> | |
288695f7 | 2846 | inline constexpr bool is_trivially_destructible_v = |
137422c8 VV |
2847 | is_trivially_destructible<_Tp>::value; |
2848 | template <typename _Tp, typename... _Args> | |
288695f7 | 2849 | inline constexpr bool is_nothrow_constructible_v = |
137422c8 VV |
2850 | is_nothrow_constructible<_Tp, _Args...>::value; |
2851 | template <typename _Tp> | |
288695f7 | 2852 | inline constexpr bool is_nothrow_default_constructible_v = |
137422c8 VV |
2853 | is_nothrow_default_constructible<_Tp>::value; |
2854 | template <typename _Tp> | |
288695f7 | 2855 | inline constexpr bool is_nothrow_copy_constructible_v = |
137422c8 VV |
2856 | is_nothrow_copy_constructible<_Tp>::value; |
2857 | template <typename _Tp> | |
288695f7 | 2858 | inline constexpr bool is_nothrow_move_constructible_v = |
137422c8 VV |
2859 | is_nothrow_move_constructible<_Tp>::value; |
2860 | template <typename _Tp, typename _Up> | |
288695f7 | 2861 | inline constexpr bool is_nothrow_assignable_v = |
137422c8 VV |
2862 | is_nothrow_assignable<_Tp, _Up>::value; |
2863 | template <typename _Tp> | |
288695f7 | 2864 | inline constexpr bool is_nothrow_copy_assignable_v = |
137422c8 VV |
2865 | is_nothrow_copy_assignable<_Tp>::value; |
2866 | template <typename _Tp> | |
288695f7 | 2867 | inline constexpr bool is_nothrow_move_assignable_v = |
137422c8 VV |
2868 | is_nothrow_move_assignable<_Tp>::value; |
2869 | template <typename _Tp> | |
288695f7 | 2870 | inline constexpr bool is_nothrow_destructible_v = |
137422c8 VV |
2871 | is_nothrow_destructible<_Tp>::value; |
2872 | template <typename _Tp> | |
288695f7 | 2873 | inline constexpr bool has_virtual_destructor_v = |
137422c8 VV |
2874 | has_virtual_destructor<_Tp>::value; |
2875 | template <typename _Tp> | |
288695f7 | 2876 | inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; |
137422c8 | 2877 | template <typename _Tp> |
288695f7 | 2878 | inline constexpr size_t rank_v = rank<_Tp>::value; |
137422c8 | 2879 | template <typename _Tp, unsigned _Idx = 0> |
288695f7 | 2880 | inline constexpr size_t extent_v = extent<_Tp, _Idx>::value; |
137422c8 | 2881 | template <typename _Tp, typename _Up> |
288695f7 | 2882 | inline constexpr bool is_same_v = is_same<_Tp, _Up>::value; |
137422c8 | 2883 | template <typename _Base, typename _Derived> |
288695f7 | 2884 | inline constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value; |
137422c8 | 2885 | template <typename _From, typename _To> |
288695f7 | 2886 | inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value; |
873c7d5a | 2887 | |
2d763763 JW |
2888 | #if __GNUC__ >= 7 |
2889 | # define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1 | |
2890 | #elif defined(__is_identifier) | |
2891 | // For non-GNU compilers: | |
2892 | # if ! __is_identifier(__has_unique_object_representations) | |
2893 | # define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1 | |
1f5700e9 JW |
2894 | # endif |
2895 | #endif | |
2896 | ||
2d763763 | 2897 | #ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP |
873c7d5a JW |
2898 | # define __cpp_lib_has_unique_object_representations 201606 |
2899 | /// has_unique_object_representations | |
2900 | template<typename _Tp> | |
2901 | struct has_unique_object_representations | |
2902 | : bool_constant<__has_unique_object_representations( | |
2903 | remove_cv_t<remove_all_extents_t<_Tp>> | |
2904 | )> | |
2905 | { }; | |
b0e63d94 JW |
2906 | |
2907 | template<typename _Tp> | |
2908 | inline constexpr bool has_unique_object_representations_v | |
2909 | = has_unique_object_representations<_Tp>::value; | |
1f5700e9 | 2910 | #endif |
2d763763 | 2911 | #undef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP |
873c7d5a | 2912 | |
afa56c17 JW |
2913 | #if __GNUC__ >= 7 |
2914 | # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 | |
2ae804bf | 2915 | #elif defined(__is_identifier) |
afa56c17 | 2916 | // For non-GNU compilers: |
2ae804bf | 2917 | # if ! __is_identifier(__is_aggregate) |
afa56c17 | 2918 | # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 |
e2ac6765 VV |
2919 | # endif |
2920 | #endif | |
2921 | ||
afa56c17 | 2922 | #ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE |
e2ac6765 VV |
2923 | #define __cpp_lib_is_aggregate 201703 |
2924 | /// is_aggregate | |
2925 | template<typename _Tp> | |
2926 | struct is_aggregate | |
2927 | : bool_constant<__is_aggregate(remove_cv_t<_Tp>)> { }; | |
2928 | ||
2929 | /// is_aggregate_v | |
2930 | template<typename _Tp> | |
2931 | inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value; | |
2932 | #endif | |
afa56c17 | 2933 | #undef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE |
e2ac6765 | 2934 | |
137422c8 | 2935 | #endif // C++17 |
6b9539e2 | 2936 | |
e641ee43 JW |
2937 | #if __cplusplus > 201703L |
2938 | /// Byte order | |
2939 | enum class endian | |
2940 | { | |
2941 | little = __ORDER_LITTLE_ENDIAN__, | |
2942 | big = __ORDER_BIG_ENDIAN__, | |
2943 | native = __BYTE_ORDER__ | |
2944 | }; | |
2945 | #endif // C++2a | |
2946 | ||
12ffa228 | 2947 | _GLIBCXX_END_NAMESPACE_VERSION |
c0ffa2ba | 2948 | } // namespace std |
7b50cdef | 2949 | |
734f5023 | 2950 | #endif // C++11 |
57317d2a | 2951 | |
7274deff | 2952 | #endif // _GLIBCXX_TYPE_TRAITS |