Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/c++/11/type_traits
$ cat -n /usr/include/c++/11/type_traits 1 // C++11
-*- C++ -*- 2 3 // Copyright (C) 2007-2021 Free Software Foundation, Inc. 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 8 // Free Software Foundation; either version 3, or (at your option) 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 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 //
. 24 25 /** @file include/type_traits 26 * This is a Standard C++ Library header. 27 */ 28 29 #ifndef _GLIBCXX_TYPE_TRAITS 30 #define _GLIBCXX_TYPE_TRAITS 1 31 32 #pragma GCC system_header 33 34 #if __cplusplus < 201103L 35 # include
36 #else 37 38 #include
39 40 namespace std _GLIBCXX_VISIBILITY(default) 41 { 42 _GLIBCXX_BEGIN_NAMESPACE_VERSION 43 44 template
45 class tuple; 46 47 template
48 class reference_wrapper; 49 50 /** 51 * @defgroup metaprogramming Metaprogramming 52 * @ingroup utilities 53 * 54 * Template utilities for compile-time introspection and modification, 55 * including type classification traits, type property inspection traits 56 * and type transformation traits. 57 * 58 * @since C++11 59 * 60 * @{ 61 */ 62 63 /// integral_constant 64 template
65 struct integral_constant 66 { 67 static constexpr _Tp value = __v; 68 typedef _Tp value_type; 69 typedef integral_constant<_Tp, __v> type; 70 constexpr operator value_type() const noexcept { return value; } 71 #if __cplusplus > 201103L 72 73 #define __cpp_lib_integral_constant_callable 201304 74 75 constexpr value_type operator()() const noexcept { return value; } 76 #endif 77 }; 78 79 template
80 constexpr _Tp integral_constant<_Tp, __v>::value; 81 82 /// The type used as a compile-time boolean with true value. 83 using true_type = integral_constant
; 84 85 /// The type used as a compile-time boolean with false value. 86 using false_type = integral_constant
; 87 88 /// @cond undocumented 89 /// bool_constant for C++11 90 template
91 using __bool_constant = integral_constant
; 92 /// @endcond 93 94 #if __cplusplus >= 201703L 95 # define __cpp_lib_bool_constant 201505 96 /// Alias template for compile-time boolean constant types. 97 /// @since C++17 98 template
99 using bool_constant = integral_constant
; 100 #endif 101 102 // Metaprogramming helper types. 103 104 template
105 struct conditional; 106 107 /// @cond undocumented 108 template
109 struct __type_identity 110 { using type = _Type; }; 111 112 template
113 using __type_identity_t = typename __type_identity<_Tp>::type; 114 115 template
116 struct __or_; 117 118 template<> 119 struct __or_<> 120 : public false_type 121 { }; 122 123 template
124 struct __or_<_B1> 125 : public _B1 126 { }; 127 128 template
129 struct __or_<_B1, _B2> 130 : public conditional<_B1::value, _B1, _B2>::type 131 { }; 132 133 template
134 struct __or_<_B1, _B2, _B3, _Bn...> 135 : public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type 136 { }; 137 138 template
139 struct __and_; 140 141 template<> 142 struct __and_<> 143 : public true_type 144 { }; 145 146 template
147 struct __and_<_B1> 148 : public _B1 149 { }; 150 151 template
152 struct __and_<_B1, _B2> 153 : public conditional<_B1::value, _B2, _B1>::type 154 { }; 155 156 template
157 struct __and_<_B1, _B2, _B3, _Bn...> 158 : public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type 159 { }; 160 161 template
162 struct __not_ 163 : public __bool_constant 164 { }; 165 /// @endcond 166 167 #if __cplusplus >= 201703L 168 169 /// @cond undocumented 170 template
171 inline constexpr bool __or_v = __or_<_Bn...>::value; 172 template
173 inline constexpr bool __and_v = __and_<_Bn...>::value; 174 /// @endcond 175 176 #define __cpp_lib_logical_traits 201510 177 178 template
179 struct conjunction 180 : __and_<_Bn...> 181 { }; 182 183 template
184 struct disjunction 185 : __or_<_Bn...> 186 { }; 187 188 template
189 struct negation 190 : __not_<_Pp> 191 { }; 192 193 /** @ingroup variable_templates 194 * @{ 195 */ 196 template
197 inline constexpr bool conjunction_v = conjunction<_Bn...>::value; 198 199 template
200 inline constexpr bool disjunction_v = disjunction<_Bn...>::value; 201 202 template
203 inline constexpr bool negation_v = negation<_Pp>::value; 204 /// @} 205 206 #endif // C++17 207 208 // Forward declarations 209 template
210 struct is_reference; 211 template
212 struct is_function; 213 template
214 struct is_void; 215 template
216 struct remove_cv; 217 template
218 struct is_const; 219 220 /// @cond undocumented 221 template
222 struct __is_array_unknown_bounds; 223 224 // Helper functions that return false_type for incomplete classes, 225 // incomplete unions and arrays of known bound from those. 226 227 template
228 constexpr true_type __is_complete_or_unbounded(__type_identity<_Tp>) 229 { return {}; } 230 231 template
233 constexpr typename __or_< 234 is_reference<_NestedType>, 235 is_function<_NestedType>, 236 is_void<_NestedType>, 237 __is_array_unknown_bounds<_NestedType> 238 >::type __is_complete_or_unbounded(_TypeIdentity) 239 { return {}; } 240 241 // For several sfinae-friendly trait implementations we transport both the 242 // result information (as the member type) and the failure information (no 243 // member type). This is very similar to std::enable_if, but we cannot use 244 // them, because we need to derive from them as an implementation detail. 245 246 template
247 struct __success_type 248 { typedef _Tp type; }; 249 250 struct __failure_type 251 { }; 252 253 // __remove_cv_t (std::remove_cv_t for C++11). 254 template
255 using __remove_cv_t = typename remove_cv<_Tp>::type; 256 257 // Primary type categories. 258 259 template
260 struct __is_void_helper 261 : public false_type { }; 262 263 template<> 264 struct __is_void_helper
265 : public true_type { }; 266 /// @endcond 267 268 /// is_void 269 template
270 struct is_void 271 : public __is_void_helper<__remove_cv_t<_Tp>>::type 272 { }; 273 274 /// @cond undocumented 275 template
276 struct __is_integral_helper 277 : public false_type { }; 278 279 template<> 280 struct __is_integral_helper
281 : public true_type { }; 282 283 template<> 284 struct __is_integral_helper
285 : public true_type { }; 286 287 template<> 288 struct __is_integral_helper
289 : public true_type { }; 290 291 template<> 292 struct __is_integral_helper
293 : public true_type { }; 294 295 // We want is_integral
to be true (and make_signed/unsigned to work) 296 // even when libc doesn't provide working
and related functions, 297 // so check __WCHAR_TYPE__ instead of _GLIBCXX_USE_WCHAR_T. 298 #ifdef __WCHAR_TYPE__ 299 template<> 300 struct __is_integral_helper
301 : public true_type { }; 302 #endif 303 304 #ifdef _GLIBCXX_USE_CHAR8_T 305 template<> 306 struct __is_integral_helper
307 : public true_type { }; 308 #endif 309 310 template<> 311 struct __is_integral_helper
312 : public true_type { }; 313 314 template<> 315 struct __is_integral_helper
316 : public true_type { }; 317 318 template<> 319 struct __is_integral_helper
320 : public true_type { }; 321 322 template<> 323 struct __is_integral_helper
324 : public true_type { }; 325 326 template<> 327 struct __is_integral_helper
328 : public true_type { }; 329 330 template<> 331 struct __is_integral_helper
332 : public true_type { }; 333 334 template<> 335 struct __is_integral_helper
336 : public true_type { }; 337 338 template<> 339 struct __is_integral_helper
340 : public true_type { }; 341 342 template<> 343 struct __is_integral_helper
344 : public true_type { }; 345 346 template<> 347 struct __is_integral_helper
348 : public true_type { }; 349 350 // Conditionalizing on __STRICT_ANSI__ here will break any port that 351 // uses one of these types for size_t. 352 #if defined(__GLIBCXX_TYPE_INT_N_0) 353 template<> 354 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0> 355 : public true_type { }; 356 357 template<> 358 struct __is_integral_helper
359 : public true_type { }; 360 #endif 361 #if defined(__GLIBCXX_TYPE_INT_N_1) 362 template<> 363 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1> 364 : public true_type { }; 365 366 template<> 367 struct __is_integral_helper
368 : public true_type { }; 369 #endif 370 #if defined(__GLIBCXX_TYPE_INT_N_2) 371 template<> 372 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2> 373 : public true_type { }; 374 375 template<> 376 struct __is_integral_helper
377 : public true_type { }; 378 #endif 379 #if defined(__GLIBCXX_TYPE_INT_N_3) 380 template<> 381 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3> 382 : public true_type { }; 383 384 template<> 385 struct __is_integral_helper
386 : public true_type { }; 387 #endif 388 /// @endcond 389 390 /// is_integral 391 template
392 struct is_integral 393 : public __is_integral_helper<__remove_cv_t<_Tp>>::type 394 { }; 395 396 /// @cond undocumented 397 template
398 struct __is_floating_point_helper 399 : public false_type { }; 400 401 template<> 402 struct __is_floating_point_helper
403 : public true_type { }; 404 405 template<> 406 struct __is_floating_point_helper
407 : public true_type { }; 408 409 template<> 410 struct __is_floating_point_helper
411 : public true_type { }; 412 413 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) && !defined(__CUDACC__) 414 template<> 415 struct __is_floating_point_helper<__float128> 416 : public true_type { }; 417 #endif 418 /// @endcond 419 420 /// is_floating_point 421 template
422 struct is_floating_point 423 : public __is_floating_point_helper<__remove_cv_t<_Tp>>::type 424 { }; 425 426 /// is_array 427 template
428 struct is_array 429 : public false_type { }; 430 431 template
432 struct is_array<_Tp[_Size]> 433 : public true_type { }; 434 435 template
436 struct is_array<_Tp[]> 437 : public true_type { }; 438 439 template
440 struct __is_pointer_helper 441 : public false_type { }; 442 443 template
444 struct __is_pointer_helper<_Tp*> 445 : public true_type { }; 446 447 /// is_pointer 448 template
449 struct is_pointer 450 : public __is_pointer_helper<__remove_cv_t<_Tp>>::type 451 { }; 452 453 /// is_lvalue_reference 454 template
455 struct is_lvalue_reference 456 : public false_type { }; 457 458 template
459 struct is_lvalue_reference<_Tp&> 460 : public true_type { }; 461 462 /// is_rvalue_reference 463 template
464 struct is_rvalue_reference 465 : public false_type { }; 466 467 template
468 struct is_rvalue_reference<_Tp&&> 469 : public true_type { }; 470 471 template
472 struct __is_member_object_pointer_helper 473 : public false_type { }; 474 475 template
476 struct __is_member_object_pointer_helper<_Tp _Cp::*> 477 : public __not_
>::type { }; 478 479 /// is_member_object_pointer 480 template
481 struct is_member_object_pointer 482 : public __is_member_object_pointer_helper<__remove_cv_t<_Tp>>::type 483 { }; 484 485 template
486 struct __is_member_function_pointer_helper 487 : public false_type { }; 488 489 template
490 struct __is_member_function_pointer_helper<_Tp _Cp::*> 491 : public is_function<_Tp>::type { }; 492 493 /// is_member_function_pointer 494 template
495 struct is_member_function_pointer 496 : public __is_member_function_pointer_helper<__remove_cv_t<_Tp>>::type 497 { }; 498 499 /// is_enum 500 template
501 struct is_enum 502 : public integral_constant
503 { }; 504 505 /// is_union 506 template
507 struct is_union 508 : public integral_constant
509 { }; 510 511 /// is_class 512 template
513 struct is_class 514 : public integral_constant
515 { }; 516 517 /// is_function 518 template
519 struct is_function 520 : public __bool_constant::value> { }; 521 522 template
523 struct is_function<_Tp&> 524 : public false_type { }; 525 526 template
527 struct is_function<_Tp&&> 528 : public false_type { }; 529 530 #define __cpp_lib_is_null_pointer 201309 531 532 template
533 struct __is_null_pointer_helper 534 : public false_type { }; 535 536 template<> 537 struct __is_null_pointer_helper
538 : public true_type { }; 539 540 /// is_null_pointer (LWG 2247). 541 template
542 struct is_null_pointer 543 : public __is_null_pointer_helper<__remove_cv_t<_Tp>>::type 544 { }; 545 546 /// __is_nullptr_t (deprecated extension). 547 /// @deprecated Use `is_null_pointer` instead. 548 template
549 struct __is_nullptr_t 550 : public is_null_pointer<_Tp> 551 { } _GLIBCXX_DEPRECATED_SUGGEST("std::is_null_pointer"); 552 553 // Composite type categories. 554 555 /// is_reference 556 template
557 struct is_reference 558 : public __or_
, 559 is_rvalue_reference<_Tp>>::type 560 { }; 561 562 /// is_arithmetic 563 template
564 struct is_arithmetic 565 : public __or_
, is_floating_point<_Tp>>::type 566 { }; 567 568 /// is_fundamental 569 template
570 struct is_fundamental 571 : public __or_
, is_void<_Tp>, 572 is_null_pointer<_Tp>>::type 573 { }; 574 575 /// is_object 576 template
577 struct is_object 578 : public __not_<__or_
, is_reference<_Tp>, 579 is_void<_Tp>>>::type 580 { }; 581 582 template
583 struct is_member_pointer; 584 585 /// is_scalar 586 template
587 struct is_scalar 588 : public __or_
, is_enum<_Tp>, is_pointer<_Tp>, 589 is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type 590 { }; 591 592 /// is_compound 593 template
594 struct is_compound 595 : public __not_
>::type { }; 596 597 /// @cond undocumented 598 template
599 struct __is_member_pointer_helper 600 : public false_type { }; 601 602 template
603 struct __is_member_pointer_helper<_Tp _Cp::*> 604 : public true_type { }; 605 /// @endcond 606 607 /// is_member_pointer 608 template
609 struct is_member_pointer 610 : public __is_member_pointer_helper<__remove_cv_t<_Tp>>::type 611 { }; 612 613 template
614 struct is_same; 615 616 /// @cond undocumented 617 template
618 using __is_one_of = __or_
...>; 619 620 // Check if a type is one of the signed integer types. 621 template
622 using __is_signed_integer = __is_one_of<__remove_cv_t<_Tp>, 623 signed char, signed short, signed int, signed long, 624 signed long long 625 #if defined(__GLIBCXX_TYPE_INT_N_0) 626 , signed __GLIBCXX_TYPE_INT_N_0 627 #endif 628 #if defined(__GLIBCXX_TYPE_INT_N_1) 629 , signed __GLIBCXX_TYPE_INT_N_1 630 #endif 631 #if defined(__GLIBCXX_TYPE_INT_N_2) 632 , signed __GLIBCXX_TYPE_INT_N_2 633 #endif 634 #if defined(__GLIBCXX_TYPE_INT_N_3) 635 , signed __GLIBCXX_TYPE_INT_N_3 636 #endif 637 >; 638 639 // Check if a type is one of the unsigned integer types. 640 template
641 using __is_unsigned_integer = __is_one_of<__remove_cv_t<_Tp>, 642 unsigned char, unsigned short, unsigned int, unsigned long, 643 unsigned long long 644 #if defined(__GLIBCXX_TYPE_INT_N_0) 645 , unsigned __GLIBCXX_TYPE_INT_N_0 646 #endif 647 #if defined(__GLIBCXX_TYPE_INT_N_1) 648 , unsigned __GLIBCXX_TYPE_INT_N_1 649 #endif 650 #if defined(__GLIBCXX_TYPE_INT_N_2) 651 , unsigned __GLIBCXX_TYPE_INT_N_2 652 #endif 653 #if defined(__GLIBCXX_TYPE_INT_N_3) 654 , unsigned __GLIBCXX_TYPE_INT_N_3 655 #endif 656 >; 657 658 // Check if a type is one of the signed or unsigned integer types. 659 template
660 using __is_standard_integer 661 = __or_<__is_signed_integer<_Tp>, __is_unsigned_integer<_Tp>>; 662 663 // __void_t (std::void_t for C++11) 664 template
using __void_t = void; 665 666 // Utility to detect referenceable types ([defns.referenceable]). 667 668 template
669 struct __is_referenceable 670 : public false_type 671 { }; 672 673 template
674 struct __is_referenceable<_Tp, __void_t<_Tp&>> 675 : public true_type 676 { }; 677 /// @endcond 678 679 // Type properties. 680 681 /// is_const 682 template
683 struct is_const 684 : public false_type { }; 685 686 template
687 struct is_const<_Tp const> 688 : public true_type { }; 689 690 /// is_volatile 691 template
692 struct is_volatile 693 : public false_type { }; 694 695 template
696 struct is_volatile<_Tp volatile> 697 : public true_type { }; 698 699 /// is_trivial 700 template
701 struct is_trivial 702 : public integral_constant
703 { 704 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 705 "template argument must be a complete class or an unbounded array"); 706 }; 707 708 /// is_trivially_copyable 709 template
710 struct is_trivially_copyable 711 : public integral_constant
712 { 713 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 714 "template argument must be a complete class or an unbounded array"); 715 }; 716 717 /// is_standard_layout 718 template
719 struct is_standard_layout 720 : public integral_constant
721 { 722 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 723 "template argument must be a complete class or an unbounded array"); 724 }; 725 726 /** is_pod (deprecated in C++20) 727 * @deprecated Use `is_standard_layout && is_trivial` instead. 728 */ 729 // Could use is_standard_layout && is_trivial instead of the builtin. 730 template
731 struct 732 _GLIBCXX20_DEPRECATED("use is_standard_layout && is_trivial instead") 733 is_pod 734 : public integral_constant
735 { 736 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 737 "template argument must be a complete class or an unbounded array"); 738 }; 739 740 /** is_literal_type 741 * @deprecated Deprecated in C++20. The idea of a literal type isn't useful. 742 */ 743 template
744 struct 745 _GLIBCXX17_DEPRECATED 746 is_literal_type 747 : public integral_constant
748 { 749 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 750 "template argument must be a complete class or an unbounded array"); 751 }; 752 753 /// is_empty 754 template
755 struct is_empty 756 : public integral_constant
757 { }; 758 759 /// is_polymorphic 760 template
761 struct is_polymorphic 762 : public integral_constant
763 { }; 764 765 #if __cplusplus >= 201402L 766 #define __cpp_lib_is_final 201402L 767 /// is_final 768 /// @since C++14 769 template
770 struct is_final 771 : public integral_constant
772 { }; 773 #endif 774 775 /// is_abstract 776 template
777 struct is_abstract 778 : public integral_constant
779 { }; 780 781 /// @cond undocumented 782 template
::value> 784 struct __is_signed_helper 785 : public false_type { }; 786 787 template
788 struct __is_signed_helper<_Tp, true> 789 : public integral_constant
790 { }; 791 /// @endcond 792 793 /// is_signed 794 template
795 struct is_signed 796 : public __is_signed_helper<_Tp>::type 797 { }; 798 799 /// is_unsigned 800 template
801 struct is_unsigned 802 : public __and_
, __not_
>> 803 { }; 804 805 /// @cond undocumented 806 template
807 _Up 808 __declval(int); 809 810 template
811 _Tp 812 __declval(long); 813 /// @endcond 814 815 template
816 auto declval() noexcept -> decltype(__declval<_Tp>(0)); 817 818 template
819 struct extent; 820 821 template
822 struct remove_all_extents; 823 824 /// @cond undocumented 825 template
826 struct __is_array_known_bounds 827 : public integral_constant
::value > 0)> 828 { }; 829 830 template
831 struct __is_array_unknown_bounds 832 : public __and_
, __not_
>> 833 { }; 834 835 // Destructible and constructible type properties. 836 837 // In N3290 is_destructible does not say anything about function 838 // types and abstract types, see LWG 2049. This implementation 839 // describes function types as non-destructible and all complete 840 // object types as destructible, iff the explicit destructor 841 // call expression is wellformed. 842 struct __do_is_destructible_impl 843 { 844 template
().~_Tp())> 845 static true_type __test(int); 846 847 template
848 static false_type __test(...); 849 }; 850 851 template
852 struct __is_destructible_impl 853 : public __do_is_destructible_impl 854 { 855 typedef decltype(__test<_Tp>(0)) type; 856 }; 857 858 template
, 860 __is_array_unknown_bounds<_Tp>, 861 is_function<_Tp>>::value, 862 bool = __or_
, is_scalar<_Tp>>::value> 863 struct __is_destructible_safe; 864 865 template
866 struct __is_destructible_safe<_Tp, false, false> 867 : public __is_destructible_impl
::type>::type 869 { }; 870 871 template
872 struct __is_destructible_safe<_Tp, true, false> 873 : public false_type { }; 874 875 template
876 struct __is_destructible_safe<_Tp, false, true> 877 : public true_type { }; 878 /// @endcond 879 880 /// is_destructible 881 template
882 struct is_destructible 883 : public __is_destructible_safe<_Tp>::type 884 { 885 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 886 "template argument must be a complete class or an unbounded array"); 887 }; 888 889 /// @cond undocumented 890 891 // is_nothrow_destructible requires that is_destructible is 892 // satisfied as well. We realize that by mimicing the 893 // implementation of is_destructible but refer to noexcept(expr) 894 // instead of decltype(expr). 895 struct __do_is_nt_destructible_impl 896 { 897 template
898 static __bool_constant
().~_Tp())> 899 __test(int); 900 901 template
902 static false_type __test(...); 903 }; 904 905 template
906 struct __is_nt_destructible_impl 907 : public __do_is_nt_destructible_impl 908 { 909 typedef decltype(__test<_Tp>(0)) type; 910 }; 911 912 template
, 914 __is_array_unknown_bounds<_Tp>, 915 is_function<_Tp>>::value, 916 bool = __or_
, is_scalar<_Tp>>::value> 917 struct __is_nt_destructible_safe; 918 919 template
920 struct __is_nt_destructible_safe<_Tp, false, false> 921 : public __is_nt_destructible_impl
::type>::type 923 { }; 924 925 template
926 struct __is_nt_destructible_safe<_Tp, true, false> 927 : public false_type { }; 928 929 template
930 struct __is_nt_destructible_safe<_Tp, false, true> 931 : public true_type { }; 932 /// @endcond 933 934 /// is_nothrow_destructible 935 template
936 struct is_nothrow_destructible 937 : public __is_nt_destructible_safe<_Tp>::type 938 { 939 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 940 "template argument must be a complete class or an unbounded array"); 941 }; 942 943 /// @cond undocumented 944 template
945 struct __is_constructible_impl 946 : public __bool_constant<__is_constructible(_Tp, _Args...)> 947 { }; 948 /// @endcond 949 950 /// is_constructible 951 template
952 struct is_constructible 953 : public __is_constructible_impl<_Tp, _Args...> 954 { 955 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 956 "template argument must be a complete class or an unbounded array"); 957 }; 958 959 /// is_default_constructible 960 template
961 struct is_default_constructible 962 : public __is_constructible_impl<_Tp>::type 963 { 964 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 965 "template argument must be a complete class or an unbounded array"); 966 }; 967 968 /// @cond undocumented 969 template
::value> 970 struct __is_copy_constructible_impl; 971 972 template
973 struct __is_copy_constructible_impl<_Tp, false> 974 : public false_type { }; 975 976 template
977 struct __is_copy_constructible_impl<_Tp, true> 978 : public __is_constructible_impl<_Tp, const _Tp&> 979 { }; 980 /// @endcond 981 982 /// is_copy_constructible 983 template
984 struct is_copy_constructible 985 : public __is_copy_constructible_impl<_Tp> 986 { 987 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 988 "template argument must be a complete class or an unbounded array"); 989 }; 990 991 /// @cond undocumented 992 template
::value> 993 struct __is_move_constructible_impl; 994 995 template
996 struct __is_move_constructible_impl<_Tp, false> 997 : public false_type { }; 998 999 template
1000 struct __is_move_constructible_impl<_Tp, true> 1001 : public __is_constructible_impl<_Tp, _Tp&&> 1002 { }; 1003 /// @endcond 1004 1005 /// is_move_constructible 1006 template
1007 struct is_move_constructible 1008 : public __is_move_constructible_impl<_Tp> 1009 { 1010 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1011 "template argument must be a complete class or an unbounded array"); 1012 }; 1013 1014 /// @cond undocumented 1015 template
1016 using __is_nothrow_constructible_impl 1017 = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>; 1018 /// @endcond 1019 1020 /// is_nothrow_constructible 1021 template
1022 struct is_nothrow_constructible 1023 : public __is_nothrow_constructible_impl<_Tp, _Args...>::type 1024 { 1025 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1026 "template argument must be a complete class or an unbounded array"); 1027 }; 1028 1029 /// is_nothrow_default_constructible 1030 template
1031 struct is_nothrow_default_constructible 1032 : public __bool_constant<__is_nothrow_constructible(_Tp)> 1033 { 1034 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1035 "template argument must be a complete class or an unbounded array"); 1036 }; 1037 1038 /// @cond undocumented 1039 template
::value> 1040 struct __is_nothrow_copy_constructible_impl; 1041 1042 template
1043 struct __is_nothrow_copy_constructible_impl<_Tp, false> 1044 : public false_type { }; 1045 1046 template
1047 struct __is_nothrow_copy_constructible_impl<_Tp, true> 1048 : public __is_nothrow_constructible_impl<_Tp, const _Tp&> 1049 { }; 1050 /// @endcond 1051 1052 /// is_nothrow_copy_constructible 1053 template
1054 struct is_nothrow_copy_constructible 1055 : public __is_nothrow_copy_constructible_impl<_Tp>::type 1056 { 1057 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1058 "template argument must be a complete class or an unbounded array"); 1059 }; 1060 1061 /// @cond undocumented 1062 template
::value> 1063 struct __is_nothrow_move_constructible_impl; 1064 1065 template
1066 struct __is_nothrow_move_constructible_impl<_Tp, false> 1067 : public false_type { }; 1068 1069 template
1070 struct __is_nothrow_move_constructible_impl<_Tp, true> 1071 : public __is_nothrow_constructible_impl<_Tp, _Tp&&> 1072 { }; 1073 /// @endcond 1074 1075 /// is_nothrow_move_constructible 1076 template
1077 struct is_nothrow_move_constructible 1078 : public __is_nothrow_move_constructible_impl<_Tp>::type 1079 { 1080 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1081 "template argument must be a complete class or an unbounded array"); 1082 }; 1083 1084 /// is_assignable 1085 template
1086 struct is_assignable 1087 : public __bool_constant<__is_assignable(_Tp, _Up)> 1088 { 1089 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1090 "template argument must be a complete class or an unbounded array"); 1091 }; 1092 1093 template
::value> 1094 struct __is_copy_assignable_impl; 1095 1096 template
1097 struct __is_copy_assignable_impl<_Tp, false> 1098 : public false_type { }; 1099 1100 template
1101 struct __is_copy_assignable_impl<_Tp, true> 1102 : public __bool_constant<__is_assignable(_Tp&, const _Tp&)> 1103 { }; 1104 1105 /// is_copy_assignable 1106 template
1107 struct is_copy_assignable 1108 : public __is_copy_assignable_impl<_Tp>::type 1109 { 1110 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1111 "template argument must be a complete class or an unbounded array"); 1112 }; 1113 1114 template
::value> 1115 struct __is_move_assignable_impl; 1116 1117 template
1118 struct __is_move_assignable_impl<_Tp, false> 1119 : public false_type { }; 1120 1121 template
1122 struct __is_move_assignable_impl<_Tp, true> 1123 : public __bool_constant<__is_assignable(_Tp&, _Tp&&)> 1124 { }; 1125 1126 /// is_move_assignable 1127 template
1128 struct is_move_assignable 1129 : public __is_move_assignable_impl<_Tp>::type 1130 { 1131 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1132 "template argument must be a complete class or an unbounded array"); 1133 }; 1134 1135 template
1136 using __is_nothrow_assignable_impl 1137 = __bool_constant<__is_nothrow_assignable(_Tp, _Up)>; 1138 1139 /// is_nothrow_assignable 1140 template
1141 struct is_nothrow_assignable 1142 : public __is_nothrow_assignable_impl<_Tp, _Up> 1143 { 1144 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1145 "template argument must be a complete class or an unbounded array"); 1146 }; 1147 1148 template
::value> 1149 struct __is_nt_copy_assignable_impl; 1150 1151 template
1152 struct __is_nt_copy_assignable_impl<_Tp, false> 1153 : public false_type { }; 1154 1155 template
1156 struct __is_nt_copy_assignable_impl<_Tp, true> 1157 : public __is_nothrow_assignable_impl<_Tp&, const _Tp&> 1158 { }; 1159 1160 /// is_nothrow_copy_assignable 1161 template
1162 struct is_nothrow_copy_assignable 1163 : public __is_nt_copy_assignable_impl<_Tp> 1164 { 1165 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1166 "template argument must be a complete class or an unbounded array"); 1167 }; 1168 1169 template
::value> 1170 struct __is_nt_move_assignable_impl; 1171 1172 template
1173 struct __is_nt_move_assignable_impl<_Tp, false> 1174 : public false_type { }; 1175 1176 template
1177 struct __is_nt_move_assignable_impl<_Tp, true> 1178 : public __is_nothrow_assignable_impl<_Tp&, _Tp&&> 1179 { }; 1180 1181 /// is_nothrow_move_assignable 1182 template
1183 struct is_nothrow_move_assignable 1184 : public __is_nt_move_assignable_impl<_Tp> 1185 { 1186 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1187 "template argument must be a complete class or an unbounded array"); 1188 }; 1189 1190 /// is_trivially_constructible 1191 template
1192 struct is_trivially_constructible 1193 : public __bool_constant<__is_trivially_constructible(_Tp, _Args...)> 1194 { 1195 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1196 "template argument must be a complete class or an unbounded array"); 1197 }; 1198 1199 /// is_trivially_default_constructible 1200 template
1201 struct is_trivially_default_constructible 1202 : public __bool_constant<__is_trivially_constructible(_Tp)> 1203 { 1204 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1205 "template argument must be a complete class or an unbounded array"); 1206 }; 1207 1208 struct __do_is_implicitly_default_constructible_impl 1209 { 1210 template
1211 static void __helper(const _Tp&); 1212 1213 template
1214 static true_type __test(const _Tp&, 1215 decltype(__helper
({}))* = 0); 1216 1217 static false_type __test(...); 1218 }; 1219 1220 template
1221 struct __is_implicitly_default_constructible_impl 1222 : public __do_is_implicitly_default_constructible_impl 1223 { 1224 typedef decltype(__test(declval<_Tp>())) type; 1225 }; 1226 1227 template
1228 struct __is_implicitly_default_constructible_safe 1229 : public __is_implicitly_default_constructible_impl<_Tp>::type 1230 { }; 1231 1232 template
1233 struct __is_implicitly_default_constructible 1234 : public __and_<__is_constructible_impl<_Tp>, 1235 __is_implicitly_default_constructible_safe<_Tp>> 1236 { }; 1237 1238 template
::value> 1239 struct __is_trivially_copy_constructible_impl; 1240 1241 template
1242 struct __is_trivially_copy_constructible_impl<_Tp, false> 1243 : public false_type { }; 1244 1245 template
1246 struct __is_trivially_copy_constructible_impl<_Tp, true> 1247 : public __and_<__is_copy_constructible_impl<_Tp>, 1248 integral_constant
> 1250 { }; 1251 1252 /// is_trivially_copy_constructible 1253 template
1254 struct is_trivially_copy_constructible 1255 : public __is_trivially_copy_constructible_impl<_Tp> 1256 { 1257 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1258 "template argument must be a complete class or an unbounded array"); 1259 }; 1260 1261 template
::value> 1262 struct __is_trivially_move_constructible_impl; 1263 1264 template
1265 struct __is_trivially_move_constructible_impl<_Tp, false> 1266 : public false_type { }; 1267 1268 template
1269 struct __is_trivially_move_constructible_impl<_Tp, true> 1270 : public __and_<__is_move_constructible_impl<_Tp>, 1271 integral_constant
> 1273 { }; 1274 1275 /// is_trivially_move_constructible 1276 template
1277 struct is_trivially_move_constructible 1278 : public __is_trivially_move_constructible_impl<_Tp> 1279 { 1280 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1281 "template argument must be a complete class or an unbounded array"); 1282 }; 1283 1284 /// is_trivially_assignable 1285 template
1286 struct is_trivially_assignable 1287 : public __bool_constant<__is_trivially_assignable(_Tp, _Up)> 1288 { 1289 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1290 "template argument must be a complete class or an unbounded array"); 1291 }; 1292 1293 template
::value> 1294 struct __is_trivially_copy_assignable_impl; 1295 1296 template
1297 struct __is_trivially_copy_assignable_impl<_Tp, false> 1298 : public false_type { }; 1299 1300 template
1301 struct __is_trivially_copy_assignable_impl<_Tp, true> 1302 : public __bool_constant<__is_trivially_assignable(_Tp&, const _Tp&)> 1303 { }; 1304 1305 /// is_trivially_copy_assignable 1306 template
1307 struct is_trivially_copy_assignable 1308 : public __is_trivially_copy_assignable_impl<_Tp> 1309 { 1310 static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), 1311 "template argument must be a complete class or an unbounded array"); 1312 }; 1313 1314 template