26 constexpr ValueType get()
const noexcept {
return m_value; }
28 constexpr BaseTime(ValueType value)
noexcept : m_value(value) { }
29 constexpr BaseTime(
const ThisType &other)
noexcept : m_value(other.m_value) { }
31 constexpr ThisType &operator=(
const ThisType &other)
noexcept
33 m_value = other.m_value;
34 return static_cast<ThisType &>(*
this);
37 friend bool comparesEqual(
const ThisType &lhs,
const ThisType &rhs)
noexcept
39 return lhs.m_value == rhs.m_value;
42 friend constexpr Qt::strong_ordering compareThreeWay(
const ThisType &lhs,
43 const ThisType &rhs)
noexcept
45 return qCompareThreeWay(lhs.m_value, rhs.m_value);
48 Q_DECLARE_STRONGLY_ORDERED(ThisType);
50 constexpr ThisType operator-()
const {
return ThisType(-m_value); }
52 friend constexpr ThisType operator+(
const ThisType &lhs,
const AmendedType &rhs)
noexcept
54 return ThisType(lhs.m_value + rhs.get());
57 template <
typename T = ThisType, std::enable_if_t<!std::is_same_v<AmendedType, T>> * =
nullptr>
58 friend constexpr ThisType operator+(
const AmendedType &lhs,
const ThisType &rhs)
noexcept
60 return ThisType(lhs.get() + rhs.m_value);
63 friend constexpr ThisType operator-(
const ThisType &lhs,
const AmendedType &rhs)
noexcept
65 return ThisType(lhs.m_value - rhs.get());
68 friend constexpr ThisType &operator+=(ThisType &lhs,
const AmendedType &rhs)
noexcept
70 lhs.m_value += rhs.get();
74 friend constexpr ThisType &operator-=(ThisType &lhs,
const AmendedType &rhs)
noexcept
76 lhs.m_value -= rhs.get();