diff --git a/include/vrv/horizontalaligner.h b/include/vrv/horizontalaligner.h index d6d428ec21..fc28823010 100644 --- a/include/vrv/horizontalaligner.h +++ b/include/vrv/horizontalaligner.h @@ -88,14 +88,8 @@ class Fraction { /** Equality operator */ bool operator==(const Fraction &other) const; - /** Less than operator */ - bool operator<(const Fraction &other) const; - /** Less than or equal operator */ - bool operator<=(const Fraction &other) const; - /** Greater than operator */ - bool operator>(const Fraction &other) const; - /** Greater than or equal operator */ - bool operator>=(const Fraction &other) const; + /** Ordering operator */ + std::strong_ordering operator<=>(const Fraction &other) const; /** Getters */ int GetNumerator() const { return m_numerator; } @@ -114,7 +108,7 @@ class Fraction { // Static methods // //----------------// - /** Reduce the faction represented by the two numbers */ + /** Reduce the fraction represented by the two numbers */ static void Reduce(int &numerator, int &denominator); private: diff --git a/src/horizontalaligner.cpp b/src/horizontalaligner.cpp index ddbf4e04f9..a219ab9323 100644 --- a/src/horizontalaligner.cpp +++ b/src/horizontalaligner.cpp @@ -94,24 +94,9 @@ bool Fraction::operator==(const Fraction &other) const return m_numerator * other.m_denominator == other.m_numerator * m_denominator; } -bool Fraction::operator<(const Fraction &other) const +std::strong_ordering Fraction::operator<=>(const Fraction &other) const { - return m_numerator * other.m_denominator < other.m_numerator * m_denominator; -} - -bool Fraction::operator<=(const Fraction &other) const -{ - return m_numerator * other.m_denominator <= other.m_numerator * m_denominator; -} - -bool Fraction::operator>(const Fraction &other) const -{ - return m_numerator * other.m_denominator > other.m_numerator * m_denominator; -} - -bool Fraction::operator>=(const Fraction &other) const -{ - return m_numerator * other.m_denominator >= other.m_numerator * m_denominator; + return m_numerator * other.m_denominator <=> other.m_numerator * m_denominator; } double Fraction::ToDouble() const