6 #ifndef SWIFT_MISC_COMPAREFUNCTIONS_H
7 #define SWIFT_MISC_COMPAREFUNCTIONS_H
14 namespace swift::misc::Compare
17 template <
typename T, std::enable_if_t<std::is_arithmetic_v<T>,
int> = 0>
20 if (a < b) {
return -1; }
21 if (b < a) {
return 1; }
26 template <
typename T, std::enable_if_t<std::is_enum_v<T>,
int> = 0>
29 using UT = std::underlying_type_t<T>;
30 return compare(
static_cast<UT
>(a),
static_cast<UT
>(b));
37 using UT =
typename QFlags<T>::Int;
38 return compare(
static_cast<UT
>(a),
static_cast<UT
>(b));
42 inline int compare(
const QDateTime &a,
const QDateTime &b)
44 return compare(a.toMSecsSinceEpoch(), b.toMSecsSinceEpoch());
int compare(T a, T b)
Compare arithmetic values.