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 1212#include < __config>
1313#include < __type_traits/integral_constant.h>
1414#include < __type_traits/is_arithmetic.h>
15- #include < __type_traits/is_integral.h>
1615
1716#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1817# pragma GCC system_header
@@ -32,24 +31,18 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_signed_v = __is_signed(_Tp);
3231
3332#else // __has_builtin(__is_signed)
3433
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-
4134template <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 ;
4336
4437template <class _Tp >
45- struct __libcpp_is_signed <_Tp, false > : false_type {} ;
38+ inline constexpr bool __is_signed_v <_Tp, true > = _Tp(- 1 ) < _Tp( 0 ) ;
4639
4740template <class _Tp >
48- struct is_signed : __libcpp_is_signed< _Tp> {};
41+ struct is_signed : integral_constant< bool , __is_signed_v< _Tp> > {};
4942
5043# if _LIBCPP_STD_VER >= 17
5144template <class _Tp >
52- inline constexpr bool is_signed_v = is_signed <_Tp>::value ;
45+ inline constexpr bool is_signed_v = __is_signed_v <_Tp>;
5346# endif
5447
5548#endif // __has_builtin(__is_signed)
Original file line number Diff line number Diff line change 1111
1212#include < __config>
1313#include < __type_traits/integral_constant.h>
14- #include < __type_traits/is_arithmetic.h>
1514#include < __type_traits/is_integral.h>
1615
1716#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -33,23 +32,17 @@ _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unsigned_v = __is_unsigned(_
3332#else // __has_builtin(__is_unsigned)
3433
3534template <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 ;
3736
3837template <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 );
4639
4740template <class _Tp >
48- struct is_unsigned : public __libcpp_is_unsigned <_Tp> {};
41+ struct is_unsigned : integral_constant< bool , __is_unsigned_v <_Tp> > {};
4942
5043# if _LIBCPP_STD_VER >= 17
5144template <class _Tp >
52- inline constexpr bool is_unsigned_v = is_unsigned <_Tp>::value ;
45+ inline constexpr bool is_unsigned_v = __is_unsigned_v <_Tp>;
5346# endif
5447
5548#endif // __has_builtin(__is_unsigned)
You can’t perform that action at this time.
0 commit comments