File tree Expand file tree Collapse file tree 2 files changed +8
-22
lines changed
libcxx/include/__type_traits Expand file tree Collapse file tree 2 files changed +8
-22
lines changed Original file line number Diff line number Diff line change 12
12
#include < __config>
13
13
#include < __type_traits/integral_constant.h>
14
14
#include < __type_traits/is_arithmetic.h>
15
- #include < __type_traits/is_integral.h>
16
15
17
16
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18
17
# pragma GCC system_header
@@ -32,24 +31,18 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_signed_v = __is_signed(_Tp);
32
31
33
32
#else // __has_builtin(__is_signed)
34
33
35
- template <class _Tp , bool = is_integral<_Tp>::value>
36
- struct __libcpp_is_signed_impl : _BoolConstant<(_Tp(-1 ) < _Tp(0 ))> {};
37
-
38
- template <class _Tp >
39
- struct __libcpp_is_signed_impl <_Tp, false > : true_type {}; // floating point
40
-
41
34
template <class _Tp , bool = is_arithmetic<_Tp>::value>
42
- struct __libcpp_is_signed : __libcpp_is_signed_impl<_Tp> {} ;
35
+ inline constexpr bool __is_signed_v = false ;
43
36
44
37
template <class _Tp >
45
- struct __libcpp_is_signed <_Tp, false > : false_type {} ;
38
+ inline constexpr bool __is_signed_v <_Tp, true > = _Tp(- 1 ) < _Tp( 0 ) ;
46
39
47
40
template <class _Tp >
48
- struct is_signed : __libcpp_is_signed< _Tp> {};
41
+ struct is_signed : integral_constant< bool , __is_signed_v< _Tp> > {};
49
42
50
43
# if _LIBCPP_STD_VER >= 17
51
44
template <class _Tp >
52
- inline constexpr bool is_signed_v = is_signed <_Tp>::value ;
45
+ inline constexpr bool is_signed_v = __is_signed_v <_Tp>;
53
46
# endif
54
47
55
48
#endif // __has_builtin(__is_signed)
Original file line number Diff line number Diff line change 11
11
12
12
#include < __config>
13
13
#include < __type_traits/integral_constant.h>
14
- #include < __type_traits/is_arithmetic.h>
15
14
#include < __type_traits/is_integral.h>
16
15
17
16
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -33,23 +32,17 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unsigned_v = __is_unsigned(_
33
32
#else // __has_builtin(__is_unsigned)
34
33
35
34
template <class _Tp , bool = is_integral<_Tp>::value>
36
- struct __libcpp_is_unsigned_impl : public _BoolConstant <(_Tp( 0 ) < _Tp(- 1 ))> {} ;
35
+ inline constexpr bool __is_unsigned_v = false ;
37
36
38
37
template <class _Tp >
39
- struct __libcpp_is_unsigned_impl <_Tp, false > : public false_type {}; // floating point
40
-
41
- template <class _Tp , bool = is_arithmetic<_Tp>::value>
42
- struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl <_Tp> {};
43
-
44
- template <class _Tp >
45
- struct __libcpp_is_unsigned <_Tp, false > : public false_type {};
38
+ inline constexpr bool __is_unsigned_v<_Tp, true > = _Tp(0 ) < _Tp(-1 );
46
39
47
40
template <class _Tp >
48
- struct is_unsigned : public __libcpp_is_unsigned <_Tp> {};
41
+ struct is_unsigned : integral_constant< bool , __is_unsigned_v <_Tp> > {};
49
42
50
43
# if _LIBCPP_STD_VER >= 17
51
44
template <class _Tp >
52
- inline constexpr bool is_unsigned_v = is_unsigned <_Tp>::value ;
45
+ inline constexpr bool is_unsigned_v = __is_unsigned_v <_Tp>;
53
46
# endif
54
47
55
48
#endif // __has_builtin(__is_unsigned)
You can’t perform that action at this time.
0 commit comments