8 template<
class A,
class B>
9 constexpr bool equal(A a, B b){
10 if constexpr (std::is_signed_v<A> && std::is_unsigned_v<B>){
11 if(
sizeof(A) >
sizeof(B)){
12 using UInt = std::make_unsigned<A>::type;
13 return (a < 0) ? false : (
static_cast<UInt
>(a) ==
static_cast<UInt
>(b));
15 using UInt = std::make_unsigned<B>::type;
16 return (a < 0) ? false : (
static_cast<UInt
>(a) ==
static_cast<UInt
>(b));
18 }
else if constexpr (std::is_unsigned_v<A> && std::is_signed_v<B>){
19 if(
sizeof(A) >
sizeof(B)){
20 using UInt = std::make_unsigned<A>::type;
21 return (b < 0) ? false : (
static_cast<UInt
>(a) ==
static_cast<UInt
>(b));
23 using UInt = std::make_unsigned<B>::type;
24 return (b < 0) ? false : (
static_cast<UInt
>(a) ==
static_cast<UInt
>(b));
31 template<std::
integral A, std::
integral B>
33 if constexpr (std::is_signed_v<A> && std::is_unsigned_v<B>){
34 if(
sizeof(A) >
sizeof(B)){
35 using UInt = std::make_unsigned<A>::type;
36 return (a < 0) ? true : (
static_cast<UInt
>(a) !=
static_cast<UInt
>(b));
38 using UInt = std::make_unsigned<B>::type;
39 return (a < 0) ? true : (
static_cast<UInt
>(a) !=
static_cast<UInt
>(b));
41 }
else if constexpr (std::is_unsigned_v<A> && std::is_signed_v<B>){
42 if(
sizeof(A) >
sizeof(B)){
43 using UInt = std::make_unsigned<A>::type;
44 return (b < 0) ? true : (
static_cast<UInt
>(a) !=
static_cast<UInt
>(b));
46 using UInt = std::make_unsigned<B>::type;
47 return (b < 0) ? true : (
static_cast<UInt
>(a) !=
static_cast<UInt
>(b));
54 template<std::
integral A, std::
integral B>
56 if constexpr (std::is_signed_v<A> && std::is_unsigned_v<B>){
57 if(
sizeof(A) >
sizeof(B)){
58 using UInt = std::make_unsigned<A>::type;
59 return (a < 0) ? true : (
static_cast<UInt
>(a) <=
static_cast<UInt
>(b));
61 using UInt = std::make_unsigned<B>::type;
62 return (a < 0) ? true : (
static_cast<UInt
>(a) <=
static_cast<UInt
>(b));
64 }
else if constexpr (std::is_unsigned_v<A> && std::is_signed_v<B>){
65 if(
sizeof(A) >
sizeof(B)){
66 using UInt = std::make_unsigned<A>::type;
67 return (b < 0) ? false : (
static_cast<UInt
>(a) <=
static_cast<UInt
>(b));
69 using UInt = std::make_unsigned<B>::type;
70 return (b < 0) ? false : (
static_cast<UInt
>(a) <=
static_cast<UInt
>(b));
77 template<std::
integral A, std::
integral B>
78 constexpr bool less(A a, B b){
79 if constexpr (std::is_signed_v<A> && std::is_unsigned_v<B>){
80 if(
sizeof(A) >
sizeof(B)){
81 using UInt = std::make_unsigned<A>::type;
82 return (a < 0) ? true : (
static_cast<UInt
>(a) <
static_cast<UInt
>(b));
84 using UInt = std::make_unsigned<B>::type;
85 return (a < 0) ? true : (
static_cast<UInt
>(a) <
static_cast<UInt
>(b));
87 }
else if constexpr (std::is_unsigned_v<A> && std::is_signed_v<B>){
88 if(
sizeof(A) >
sizeof(B)){
89 using UInt = std::make_unsigned<A>::type;
90 return (b < 0) ? false : (
static_cast<UInt
>(a) <
static_cast<UInt
>(b));
92 using UInt = std::make_unsigned<B>::type;
93 return (b < 0) ? false : (
static_cast<UInt
>(a) <
static_cast<UInt
>(b));
100 template<std::
integral A, std::
integral B>
102 if constexpr (std::is_signed_v<A> && std::is_unsigned_v<B>){
103 if(
sizeof(A) >
sizeof(B)){
104 using UInt = std::make_unsigned<A>::type;
105 return (a < 0) ? false : (
static_cast<UInt
>(a) >=
static_cast<UInt
>(b));
107 using UInt = std::make_unsigned<B>::type;
108 return (a < 0) ? false : (
static_cast<UInt
>(a) >=
static_cast<UInt
>(b));
110 }
else if constexpr (std::is_unsigned_v<A> && std::is_signed_v<B>){
111 if(
sizeof(A) >
sizeof(B)){
112 using UInt = std::make_unsigned<A>::type;
113 return (b < 0) ? true : (
static_cast<UInt
>(a) >=
static_cast<UInt
>(b));
115 using UInt = std::make_unsigned<B>::type;
116 return (b < 0) ? true : (
static_cast<UInt
>(a) >=
static_cast<UInt
>(b));
123 template<std::
integral A, std::
integral B>
125 if constexpr (std::is_signed_v<A> && std::is_unsigned_v<B>){
126 if(
sizeof(A) >
sizeof(B)){
127 using UInt = std::make_unsigned<A>::type;
128 return (a < 0) ? false : (
static_cast<UInt
>(a) >
static_cast<UInt
>(b));
130 using UInt = std::make_unsigned<B>::type;
131 return (a < 0) ? false : (
static_cast<UInt
>(a) >
static_cast<UInt
>(b));
133 }
else if constexpr (std::is_unsigned_v<A> && std::is_signed_v<B>){
134 if(
sizeof(A) >
sizeof(B)){
135 using UInt = std::make_unsigned<A>::type;
136 return (b < 0) ? true : (
static_cast<UInt
>(a) >
static_cast<UInt
>(b));
138 using UInt = std::make_unsigned<B>::type;
139 return (b < 0) ? true : (
static_cast<UInt
>(a) >
static_cast<UInt
>(b));
Definition Duration.hpp:17
constexpr bool equal(A a, B b)
Definition functional.hpp:9
constexpr bool greater_equal(A a, B b)
Definition functional.hpp:101
constexpr bool not_equal(A a, B b)
Definition functional.hpp:32
constexpr bool less_equal(A a, B b)
Definition functional.hpp:55
constexpr bool greater(A a, B b)
Definition functional.hpp:124
constexpr bool less(A a, B b)
Definition functional.hpp:78