Use default operators generated/synthesized by compiler

This commit is contained in:
Chocobo1
2022-04-02 13:34:52 +08:00
parent 10ee1ab7a2
commit 7612d5d0ef
15 changed files with 4 additions and 76 deletions

View File

@@ -124,13 +124,12 @@ namespace Utils
return res;
}
// TODO: remove manually defined operators and use compiler generated `operator<=>()` in C++20
friend bool operator==(const ThisType &left, const ThisType &right)
friend constexpr bool operator==(const ThisType &left, const ThisType &right)
{
return (left.m_components == right.m_components);
}
friend bool operator<(const ThisType &left, const ThisType &right)
friend constexpr bool operator<(const ThisType &left, const ThisType &right)
{
return (left.m_components < right.m_components);
}
@@ -159,12 +158,6 @@ namespace Utils
std::array<int, N> m_components {{}};
};
template <int N, int Mandatory>
constexpr bool operator!=(const Version<N, Mandatory> &left, const Version<N, Mandatory> &right)
{
return !(left == right);
}
template <int N, int Mandatory>
constexpr bool operator>(const Version<N, Mandatory> &left, const Version<N, Mandatory> &right)
{