diff --git a/src/base/utils/version.h b/src/base/utils/version.h index 22952f7f6..d18df83e0 100644 --- a/src/base/utils/version.h +++ b/src/base/utils/version.h @@ -133,19 +133,15 @@ namespace Utils return (*this != ThisType {}); } - constexpr bool operator==(const ThisType &other) const + // TODO: remove manually defined operators and use compiler generated `operator<=>()` in C++20 + friend bool operator==(const ThisType &left, const ThisType &right) { - return (m_components == other.m_components); + return (left.m_components == right.m_components); } - constexpr bool operator<(const ThisType &other) const + friend bool operator<(const ThisType &left, const ThisType &right) { - return (m_components < other.m_components); - } - - constexpr bool operator>(const ThisType &other) const - { - return (m_components > other.m_components); + return (left.m_components < right.m_components); } template @@ -198,6 +194,12 @@ namespace Utils return !(left == right); } + template + constexpr bool operator>(const Version &left, const Version &right) + { + return (right < left); + } + template constexpr bool operator<=(const Version &left, const Version &right) {