mirror of
https://github.com/boostorg/move.git
synced 2025-07-29 20:07:13 +02:00
- Add is_unsigned trait
- Add make_unsigned for 128 bit integers - Fix is_scalar traits
This commit is contained in:
@ -581,6 +581,28 @@ struct remove_cvref
|
||||
{
|
||||
};
|
||||
|
||||
//////////////////////////
|
||||
// is_unsigned
|
||||
//////////////////////////
|
||||
template<class T> struct is_unsigned_cv { static const bool value = true; };
|
||||
template <> struct is_unsigned_cv<signed char> { static const bool value = false; };
|
||||
template <> struct is_unsigned_cv<signed short> { static const bool value = false; };
|
||||
template <> struct is_unsigned_cv<signed int> { static const bool value = false; };
|
||||
template <> struct is_unsigned_cv<signed long> { static const bool value = false; };
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
template <> struct is_unsigned_cv< ::boost::long_long_type > { static const bool value = false; };
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_INT128
|
||||
template <> struct is_unsigned_cv< ::boost::int128_type > { static const bool value = false; };
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
struct is_unsigned
|
||||
: is_unsigned_cv<typename remove_cv<T>::type>
|
||||
{};
|
||||
|
||||
|
||||
//////////////////////////
|
||||
// make_unsigned
|
||||
//////////////////////////
|
||||
@ -594,6 +616,11 @@ template <> struct make_unsigned_impl<signed long> { typedef uns
|
||||
template <> struct make_unsigned_impl< ::boost::long_long_type > { typedef ::boost::ulong_long_type type; };
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_INT128
|
||||
template <> struct make_unsigned_impl< ::boost::int128_type > { typedef ::boost::uint128_type type; };
|
||||
#endif
|
||||
|
||||
|
||||
template <class T>
|
||||
struct make_unsigned
|
||||
: make_unsigned_impl<typename remove_cv<T>::type>
|
||||
@ -639,6 +666,13 @@ template<> struct is_integral_cv< unsigned long>{ static const bool
|
||||
template<> struct is_integral_cv< ::boost:: long_long_type>{ static const bool value = true; };
|
||||
template<> struct is_integral_cv< ::boost::ulong_long_type>{ static const bool value = true; };
|
||||
#endif
|
||||
#ifdef BOOST_HAS_INT128
|
||||
template <> struct is_integral_cv< ::boost::int128_type > { static const bool value = true; };
|
||||
template <> struct is_integral_cv< ::boost::uint128_type > { static const bool value = true; };
|
||||
#endif
|
||||
#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
|
||||
template<> struct is_integral_cv<char8_t> { static const bool value = true; };
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
struct is_integral
|
||||
@ -660,13 +694,6 @@ template <class T, std::size_t N>
|
||||
struct remove_all_extents<T[N]>
|
||||
{ typedef typename remove_all_extents<T>::type type;};
|
||||
|
||||
//////////////////////////
|
||||
// is_scalar
|
||||
//////////////////////////
|
||||
template<class T>
|
||||
struct is_scalar
|
||||
{ static const bool value = is_integral<T>::value || is_floating_point<T>::value; };
|
||||
|
||||
//////////////////////////
|
||||
// is_void
|
||||
//////////////////////////
|
||||
@ -732,6 +759,11 @@ struct is_nullptr_t
|
||||
: is_nullptr_t_cv<typename remove_cv<T>::type>
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct is_null_pointer
|
||||
: is_nullptr_t_cv<typename remove_cv<T>::type>
|
||||
{};
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_function
|
||||
//////////////////////////////////////
|
||||
@ -802,6 +834,7 @@ struct is_arithmetic
|
||||
is_integral<T>::value;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_member_function_pointer
|
||||
//////////////////////////////////////
|
||||
@ -829,21 +862,38 @@ struct is_member_function_pointer
|
||||
template <class T>
|
||||
struct is_enum_nonintrinsic
|
||||
{
|
||||
static const bool value = !is_arithmetic<T>::value &&
|
||||
!is_reference<T>::value &&
|
||||
!is_class_or_union<T>::value &&
|
||||
!is_array<T>::value &&
|
||||
!is_void<T>::value &&
|
||||
!is_nullptr_t<T>::value &&
|
||||
!is_member_pointer<T>::value &&
|
||||
!is_pointer<T>::value &&
|
||||
!is_function<T>::value;
|
||||
static const bool value = !is_arithmetic<T>::value &&
|
||||
!is_reference<T>::value &&
|
||||
!is_class_or_union<T>::value &&
|
||||
!is_array<T>::value &&
|
||||
!is_void<T>::value &&
|
||||
!is_nullptr_t<T>::value &&
|
||||
!is_member_pointer<T>::value &&
|
||||
!is_pointer<T>::value &&
|
||||
!is_function<T>::value;
|
||||
};
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
struct is_enum
|
||||
{ static const bool value = BOOST_MOVE_IS_ENUM_IMPL(T); };
|
||||
{
|
||||
static const bool value = BOOST_MOVE_IS_ENUM_IMPL(T);
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////
|
||||
// is_scalar
|
||||
//////////////////////////
|
||||
template<class T>
|
||||
struct is_scalar
|
||||
{
|
||||
static const bool value = is_arithmetic<T>::value ||
|
||||
is_enum<T>::value ||
|
||||
is_pointer<T>::value ||
|
||||
is_member_pointer<T>::value ||
|
||||
is_null_pointer<T>::value;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_pod
|
||||
|
Reference in New Issue
Block a user