18 template<
class T,
class compare_t>
19 constexpr
bool between(T left, T value, T right, compare_t compare)
21 if constexpr (std::is_enum_v<T>)
23 i64 l =
static_cast<i64
>(left);
24 i64 r =
static_cast<i64
>(right);
25 i64 v =
static_cast<i64
>(value);
26 return between(l, v, r, compare);
28 else if constexpr (std::is_integral_v<T> && std::is_same_v<compare_t, std::less_equal<>>)
30 return compare(
static_cast<size_t>(value - left), right - left);
32 else if constexpr (std::is_floating_point_v<T> && std::is_same_v<compare_t, std::less_equal<>>)
38 return compare(left, value) && compare(value, right);
42 template<
class T,
class compare_t>
43 constexpr
bool between(T left, T value, T right)
46 return between(left, value, right, compare_t());
constexpr bool between(T left, T value, T right)
Checks if value is between left and right.
constexpr bool epsilon_less_equal(T left, T right, T eps=std::numeric_limits< T >::epsilon())
Constexpr comparison function for a user defined epsilon values.
#define QX_RESTORE_MSVC_WARNINGS(warnings)
Enable warnings after QX_DISABLE_MSVC_WARNINGS.
#define QX_PUSH_SUPPRESS_MSVC_WARNINGS(warnings)
Disable specified MSVC warnings.
#define QX_DISABLE_MSVC_WARNINGS(warnings)
Force disable MSVC warnings, including all nested header includes.
#define QX_POP_SUPPRESS_WARNINGS()
Enable all warnings.