5 #ifndef VCCC_UTILITY_CMP_HPP_
6 #define VCCC_UTILITY_CMP_HPP_
18 template<
typename T,
typename U,
typename... SameSignity>
19 constexpr
bool cmp_equal_impl(T t, U u, SameSignity...) noexcept {
23 template<
typename T,
typename U>
24 constexpr
bool cmp_equal_impl(T t, U u, std::true_type, std::false_type) noexcept {
25 return t >= 0 && std::make_unsigned_t<T>(t) == u;
28 template<
typename T,
typename U>
29 constexpr
bool cmp_equal_impl(T t, U u, std::false_type, std::true_type) noexcept {
30 return u >= 0 && std::make_unsigned_t<U>(u) == t;
33 template<
typename T,
typename U,
typename... SameSignity>
34 constexpr
bool cmp_less_impl(T t, U u, SameSignity...) noexcept {
38 template<
typename T,
typename U>
39 constexpr
bool cmp_less_impl(T t, U u, std::true_type, std::false_type) noexcept {
40 return t < 0 || std::make_unsigned_t<T>(t) < u;
43 template<
typename T,
typename U>
44 constexpr
bool cmp_less_impl(T t, U u, std::false_type, std::true_type) noexcept {
45 return u >= 0 && t < std::make_unsigned_t<U>(u);
49 using cmp_requires_one =
52 negation<is_character<T>>,
53 negation<std::is_same<T, bool>>
55 template<
typename T,
typename U>
56 using cmp_requires = conjunction<cmp_requires_one<remove_cvref_t<T>>, cmp_requires_one<remove_cvref_t<U>>>;
63 template<
typename T,
typename U>
66 return vccc::detail::cmp_equal_impl(t, u, std::is_signed<T>{}, std::is_signed<U>{});
69 template<
typename T,
typename U>
74 template<
typename T,
typename U>
77 return vccc::detail::cmp_less_impl(t, u, std::is_signed<T>{}, std::is_signed<U>{});
80 template<
typename T,
typename U>
85 template<
class T,
class U>
90 template<
class T,
class U>
constexpr bool cmp_greater(T t, U u) noexcept
Definition: cmp.hpp:81
constexpr bool cmp_greater_equal(T t, U u) noexcept
Definition: cmp.hpp:91
constexpr bool cmp_not_equal(T t, U u) noexcept
Definition: cmp.hpp:70
constexpr bool cmp_less(T t, U u) noexcept
Definition: cmp.hpp:75
constexpr bool cmp_less_equal(T t, U u) noexcept
Definition: cmp.hpp:86
constexpr bool cmp_equal(T t, U u) noexcept
Definition: cmp.hpp:64
Definition: directory.h:12
Definition: conjunction.hpp:22