This documentation is automatically generated by competitive-verifier/competitive-verifier
#include "tools/cmp_less_equal.hpp"template <tools::integral T, tools::integral U>
constexpr bool cmp_less_equal(T t, U u) noexcept;
It is almost identical to std::cmp_less_equal, but compatible with user-defined extended integral types.
#ifndef TOOLS_CMP_LESS_EQUAL_HPP
#define TOOLS_CMP_LESS_EQUAL_HPP
#include "tools/cmp_less.hpp"
#include "tools/integral.hpp"
namespace tools {
template <tools::integral T, tools::integral U>
constexpr bool cmp_less_equal(const T t, const U u) noexcept {
return !tools::cmp_less(u, t);
}
}
#endif
#line 1 "tools/cmp_less_equal.hpp"
#line 1 "tools/cmp_less.hpp"
#line 1 "tools/integral.hpp"
#line 1 "tools/is_integral.hpp"
#include <type_traits>
namespace tools {
template <typename T>
struct is_integral : std::is_integral<T> {};
template <typename T>
inline constexpr bool is_integral_v = tools::is_integral<T>::value;
}
#line 5 "tools/integral.hpp"
namespace tools {
template <typename T>
concept integral = tools::is_integral_v<T>;
}
#line 1 "tools/is_signed.hpp"
#line 5 "tools/is_signed.hpp"
namespace tools {
template <typename T>
struct is_signed : std::is_signed<T> {};
template <typename T>
inline constexpr bool is_signed_v = tools::is_signed<T>::value;
}
#line 1 "tools/make_unsigned.hpp"
#line 5 "tools/make_unsigned.hpp"
namespace tools {
template <typename T>
struct make_unsigned : std::make_unsigned<T> {};
template <typename T>
using make_unsigned_t = typename tools::make_unsigned<T>::type;
}
#line 7 "tools/cmp_less.hpp"
namespace tools {
template <tools::integral T, tools::integral U>
constexpr bool cmp_less(const T t, const U u) noexcept {
using UT = tools::make_unsigned_t<T>;
using UU = tools::make_unsigned_t<U>;
if constexpr (tools::is_signed_v<T> == tools::is_signed_v<U>) {
return t < u;
} else if constexpr (tools::is_signed_v<T>) {
return t < 0 ? true : static_cast<UT>(t) < u;
} else {
return u < 0 ? false : t < static_cast<UU>(u);
}
}
}
#line 6 "tools/cmp_less_equal.hpp"
namespace tools {
template <tools::integral T, tools::integral U>
constexpr bool cmp_less_equal(const T t, const U u) noexcept {
return !tools::cmp_less(u, t);
}
}