mirror of
https://github.com/boostorg/move.git
synced 2025-07-31 04:47:14 +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
|
// 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; };
|
template <> struct make_unsigned_impl< ::boost::long_long_type > { typedef ::boost::ulong_long_type type; };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef BOOST_HAS_INT128
|
||||||
|
template <> struct make_unsigned_impl< ::boost::int128_type > { typedef ::boost::uint128_type type; };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct make_unsigned
|
struct make_unsigned
|
||||||
: make_unsigned_impl<typename remove_cv<T>::type>
|
: 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:: long_long_type>{ static const bool value = true; };
|
||||||
template<> struct is_integral_cv< ::boost::ulong_long_type>{ static const bool value = true; };
|
template<> struct is_integral_cv< ::boost::ulong_long_type>{ static const bool value = true; };
|
||||||
#endif
|
#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>
|
template<class T>
|
||||||
struct is_integral
|
struct is_integral
|
||||||
@ -660,13 +694,6 @@ template <class T, std::size_t N>
|
|||||||
struct remove_all_extents<T[N]>
|
struct remove_all_extents<T[N]>
|
||||||
{ typedef typename remove_all_extents<T>::type type;};
|
{ 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
|
// is_void
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
@ -732,6 +759,11 @@ struct is_nullptr_t
|
|||||||
: is_nullptr_t_cv<typename remove_cv<T>::type>
|
: 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
|
// is_function
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
@ -802,6 +834,7 @@ struct is_arithmetic
|
|||||||
is_integral<T>::value;
|
is_integral<T>::value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// is_member_function_pointer
|
// is_member_function_pointer
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
@ -843,7 +876,24 @@ struct is_enum_nonintrinsic
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct is_enum
|
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
|
// is_pod
|
||||||
|
Reference in New Issue
Block a user