Skip to content

Commit

Permalink
Added is_signed to <type_traits> (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZERICO2005 authored Jan 14, 2025
1 parent 880feef commit f2db504
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libcxx/include/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ template<class _Tp> inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::
template<class _Tp> using is_fundamental = disjunction<is_void<_Tp>, is_null_pointer<_Tp>, is_arithmetic<_Tp>>;
template<class _Tp> inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;

template<class _Tp, bool = is_arithmetic<_Tp>::value> struct __is_signed : integral_constant<bool, _Tp(-1) < _Tp(0)> {};
template<class _Tp> struct __is_signed<_Tp, false> : false_type {};
template<class _Tp> struct is_signed : __is_signed<_Tp>::type {};
template<class _Tp> constexpr bool is_signed_v = is_signed<_Tp>::value;

template<class _Tp, bool = is_arithmetic<_Tp>::value> struct __is_unsigned : integral_constant<bool, _Tp(0) < _Tp(-1)> {};
template<class _Tp> struct __is_unsigned<_Tp, false> : false_type {};
template<class _Tp> struct is_unsigned : __is_unsigned<_Tp>::type {};
template<class _Tp> constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;

template<class> struct is_array : false_type {};
template<class _Tp> struct is_array<_Tp[]> : true_type {};
template<class _Tp, size_t _Np> struct is_array<_Tp[_Np]> : true_type {};
Expand Down

0 comments on commit f2db504

Please sign in to comment.