Changeset ca8d393 in mainline
- Timestamp:
- 2018-07-05T21:41:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 08c1df0
- Parents:
- bfc972e
- git-author:
- Dzejrou <dzejrou@…> (2018-05-16 17:20:04)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:24)
- Location:
- uspace/lib/cpp/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/type_traits.hpp
rbfc972e rca8d393 47 47 add_rvalue_reference_t<T> declval() noexcept; 48 48 49 /**50 * 20.10.3, helper class:51 */52 53 template<class T, T v>54 struct integral_constant55 {56 static constexpr T value = v;57 58 using value_type = T;59 using type = integral_constant<T, v>;60 61 constexpr operator value_type() const noexcept62 {63 return value;64 }65 66 constexpr value_type operator()() const noexcept67 {68 return value;69 }70 };71 72 using true_type = integral_constant<bool, true>;73 using false_type = integral_constant<bool, false>;74 75 49 template<class...> 76 50 using void_t = void; … … 959 933 /** 960 934 * 20.10.7.3, sign modifications: 935 * Note: These are fairly naive implementations that 936 * are meant to keep our code going (i.e. they work 937 * for the most common types, but I'm not sure 938 * if there are any intricacies required by 939 * the standard). 961 940 */ 962 941 963 942 template<class T> 964 struct make_signed; 965 966 template<class T> 967 struct make_unsigned; 943 struct make_signed: aux::type_is<T> 944 { /* DUMMY BODY */ }; 945 946 template<> 947 struct make_signed<unsigned char>: aux::type_is<signed char> 948 { /* DUMMY BODY */ }; 949 950 template<> 951 struct make_signed<unsigned short>: aux::type_is<short> 952 { /* DUMMY BODY */ }; 953 954 template<> 955 struct make_signed<unsigned int>: aux::type_is<int> 956 { /* DUMMY BODY */ }; 957 958 template<> 959 struct make_signed<unsigned long>: aux::type_is<long> 960 { /* DUMMY BODY */ }; 961 962 template<> 963 struct make_signed<unsigned long long>: aux::type_is<long long> 964 { /* DUMMY BODY */ }; 965 966 template<class T> 967 struct make_unsigned: aux::type_is<T> 968 { /* DUMMY BODY */ }; 969 970 template<> 971 struct make_unsigned<signed char>: aux::type_is<unsigned char> 972 { /* DUMMY BODY */ }; 973 974 template<> 975 struct make_unsigned<short>: aux::type_is<unsigned short> 976 { /* DUMMY BODY */ }; 977 978 template<> 979 struct make_unsigned<int>: aux::type_is<unsigned int> 980 { /* DUMMY BODY */ }; 981 982 template<> 983 struct make_unsigned<long>: aux::type_is<unsigned long> 984 { /* DUMMY BODY */ }; 985 986 template<> 987 struct make_unsigned<long long>: aux::type_is<unsigned long long> 988 { /* DUMMY BODY */ }; 968 989 969 990 template<class T> -
uspace/lib/cpp/include/internal/aux.hpp
rbfc972e rca8d393 30 30 #define LIBCPP_AUX 31 31 32 namespace std 33 { 34 /** 35 * 20.10.3, helper class: 36 */ 37 38 template<class T, T v> 39 struct integral_constant 40 { 41 static constexpr T value = v; 42 43 using value_type = T; 44 using type = integral_constant<T, v>; 45 46 constexpr operator value_type() const noexcept 47 { 48 return value; 49 } 50 51 constexpr value_type operator()() const noexcept 52 { 53 return value; 54 } 55 }; 56 57 using true_type = integral_constant<bool, true>; 58 using false_type = integral_constant<bool, false>; 59 } 60 32 61 namespace std::aux 33 62 { … … 55 84 }; 56 85 86 // For compatibility with integral_constant. 57 87 template<class T, T v> 58 struct value_is 59 { 60 static constexpr T value = v; 61 }; 88 using value_is = std::integral_constant<T, v>; 62 89 } 63 90
Note:
See TracChangeset
for help on using the changeset viewer.