Changeset 484200d in mainline
- Timestamp:
- 2018-07-05T21:41:18Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d654ca6
- Parents:
- 4f6e56f
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-11-23 23:20:40)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/type_traits.hpp
r4f6e56f r484200d 78 78 { /* DUMMY BODY */ }; 79 79 80 template<class T, class U> 81 struct is_one_of: is_same<T, Y> 82 { /* DUMMY BODY */ }; 83 84 template<class T, class, class... Ts> 85 struct is_one_of: is_one_of<T, Ts...> 86 { /* DUMMY BODY */ }; 87 88 template<class T, class U, class...> 89 struct is_one_of: true_type 80 template<class T, class... Ts> 81 struct is_one_of; 82 83 template<class T> 84 struct is_one_of<T>: false_type 85 { /* DUMMY BODY */ }; 86 87 template<class T, class... Ts> 88 struct is_one_of<T, T, Ts...>: true_type 89 { /* DUMMY BODY */ }; 90 91 template<class T, class U, class... Ts> 92 struct is_one_of<T, U, Ts...>: is_one_of<T, Ts...> 90 93 { /* DUMMY BODY */ }; 91 94 } … … 96 99 97 100 template<class T> 98 struct is_void: is_same<remove_cv_t<T>, void>99 { /* DUMMY BODY */ }; 100 101 template<class T> 102 struct is_null_pointer: is_same<remove_cv_t<T>, nullptr_t>101 struct is_void: aux::is_same<remove_cv_t<T>, void> 102 { /* DUMMY BODY */ }; 103 104 template<class T> 105 struct is_null_pointer: aux::is_same<remove_cv_t<T>, nullptr_t> 103 106 { /* DUMMY BODY */ }; 104 107 … … 112 115 template<class T> 113 116 struct is_floating_point 114 : is_one_of<remove_cv_t<T>, float, double, long double>117 : aux::is_one_of<remove_cv_t<T>, float, double, long double> 115 118 { /* DUMMY BODY */ }; 116 119 … … 185 188 186 189 template<class T> 187 struct is_enum: aux::value_is< __is_enum(T)>188 { /* DUMMY BODY */ }; 189 190 template<class T> 191 struct is_union: aux::value_is< __is_union(T)>192 { /* DUMMY BODY */ }; 193 194 template<class T> 195 struct is_class: aux::value_is< __is_class(T)>190 struct is_enum: aux::value_is<bool, __is_enum(T)> 191 { /* DUMMY BODY */ }; 192 193 template<class T> 194 struct is_union: aux::value_is<bool, __is_union(T)> 195 { /* DUMMY BODY */ }; 196 197 template<class T> 198 struct is_class: aux::value_is<bool, __is_class(T)> 196 199 { /* DUMMY BODY */ }; 197 200 … … 401 404 402 405 template<class T> 403 struct is_reference; 406 struct is_reference: false_type 407 { /* DUMMY BODY */ }; 408 409 template<class T> 410 struct is_reference<T&>: true_type 411 { /* DUMMY BODY */ }; 412 413 template<class T> 414 struct is_reference<T&&>: true_type 415 { /* DUMMY BODY */ }; 404 416 405 417 template<class T> … … 455 467 struct is_volatile<T volatile>: true_type 456 468 { /* DUMMY BODY */ }; 469 470 /** 471 * 2 forward declarations. 472 */ 473 474 template<class T> 475 struct is_trivially_copyable; 476 477 template<class T> 478 struct is_trivially_default_constructible; 457 479 458 480 template<class T> … … 606 628 607 629 template<class T> 608 struct has_virtual_destructor: aux::value_is<bool, __has_ nothrow_destructor(T)>630 struct has_virtual_destructor: aux::value_is<bool, __has_virtual_destructor(T)> 609 631 { /* DUMMY BODY */ }; 610 632 … … 661 683 662 684 template<class T> 663 struct remove_cv; 685 struct remove_cv: aux::type_is<T> 686 { /* DUMMY BODY */ }; 687 688 template<class T> 689 struct remove_cv<T const>: aux::type_is<T> 690 { /* DUMMY BODY */ }; 691 692 template<class T> 693 struct remove_cv<T volatile>: aux::type_is<T> 694 { /* DUMMY BODY */ }; 695 696 template<class T> 697 struct remove_cv<T const volatile>: aux::type_is<T> 698 { /* DUMMY BODY */ }; 664 699 665 700 template<class T> … … 709 744 struct add_lvalue_reference; 710 745 711 template<class T> 712 struct add_rvalue_reference; 746 // TODO: Special case when T is not referencable! 747 template<class T> 748 struct add_rvalue_reference: aux::type_is<T&&> 749 { /* DUMMY BODY */ }; 750 751 template<class T> 752 struct add_rvalue_reference<T&>: aux::type_is<T&> 753 { /* DUMMY BODY */ }; 713 754 714 755 template<class T> … … 772 813 * 20.10.7.6, other transformations: 773 814 */ 815 816 template<class...> 817 using void_t = void; 774 818 775 819 // TODO: consult standard on the default value of align … … 780 824 struct aligned_union; 781 825 782 template<class T> 783 struct decay; 826 // TODO: this is very basic implementation for chrono, fix! 827 template<class T> 828 struct decay: aux::type_is<remove_cv_t<remove_reference_t<T>>> 829 { /* DUMMY BODY */ }; 830 831 template<class T> 832 using decay_t = typename decay<T>::type; 784 833 785 834 template<bool, class T = void> 786 835 struct enable_if 787 { /* DUMMY BODY */ } 836 { /* DUMMY BODY */ }; 788 837 789 838 template<class T> 790 839 struct enable_if<true, T>: aux::type_is<T> 791 { /* DUMMY BODY */ } 840 { /* DUMMY BODY */ }; 792 841 793 842 template<bool, class T, class F> … … 800 849 801 850 template<class... T> 802 struct common_type; 851 struct common_type 852 { /* DUMMY BODY */ }; 853 854 template<class... T> 855 using common_type_t = typename common_type<T...>::type; 856 857 template<class T> 858 struct common_type<T>: common_type<T, T> 859 { /* DUMMY BODY */ }; 860 861 // To avoid circular dependency with <utility>. 862 template<class T> 863 add_rvalue_reference_t<T> declval() noexcept; 864 865 template<class T1, class T2> 866 struct common_type<T1, T2>: aux::type_is<decay_t<decltype(false ? declval<T1>() : declval<T2>())>> 867 { /* DUMMY BODY */ }; 868 869 template<class T1, class T2, class... Ts> 870 struct common_type<T1, T2, Ts...> 871 : aux::type_is<common_type_t<common_type_t<T1, T2>, Ts...>> 872 { /* DUMMY BODY */ }; 803 873 804 874 template<class... T> … … 817 887 using aligned_union_t = typename aligned_union<Len, Types...>::type; 818 888 819 template<class T>820 using decay_t = typename decay<T>::type;821 822 889 template<bool b, class T = void> 823 890 using enable_if_t = typename enable_if<b, T>::type; … … 826 893 using conditional_t = typename conditional<b, T, F>::type; 827 894 828 template<class... T>829 using common_type_t = typename common_type<T...>::type;830 831 895 template<class T> 832 896 using underlying_type_t = typename underlying_type<T>::type; … … 834 898 template<class T> 835 899 using result_of_t = typename result_of<T>::type; 836 837 template<class...>838 using void_t = void;839 900 } 840 901
Note:
See TracChangeset
for help on using the changeset viewer.