8#ifndef SEN_CORE_BASE_INTEGER_COMPARE_H
9#define SEN_CORE_BASE_INTEGER_COMPARE_H
11#if defined(__cpp_lib_integer_comparison_functions)
18#if defined(__cpp_lib_integer_comparison_functions)
22using std::cmp_greater;
23using std::cmp_greater_equal;
25using std::cmp_less_equal;
26using std::cmp_not_equal;
34template <
class T,
class U>
38 if constexpr (std::is_signed_v<T> == std::is_signed_v<U>)
42 else if constexpr (std::is_signed_v<T>)
45 return t >= 0 && std::make_unsigned_t<T>(t) == u;
50 return u >= 0 && std::make_unsigned_t<U>(u) == t;
54template <
class T,
class U>
61template <
class T,
class U>
65 if constexpr (std::is_signed_v<T> == std::is_signed_v<U>)
69 else if constexpr (std::is_signed_v<T>)
72 return t < 0 || std::make_unsigned_t<T>(t) < u;
77 return u >= 0 && t < std::make_unsigned_t<U>(u);
81template <
class T,
class U>
88template <
class T,
class U>
95template <
class T,
class U>
constexpr bool cmp_greater(T t, U u) noexcept
Definition integer_compare.h:83
constexpr bool cmp_equal(T t, U u) noexcept
Definition integer_compare.h:36
constexpr bool cmp_not_equal(T t, U u) noexcept
Definition integer_compare.h:56
constexpr bool cmp_less_equal(T t, U u) noexcept
Definition integer_compare.h:90
constexpr bool cmp_less(T t, U u) noexcept
Definition integer_compare.h:63
constexpr bool cmp_greater_equal(T t, U u) noexcept
Definition integer_compare.h:97