See the docs on Default comparisons (since C++20) https://en.cppreference.com/w/cpp/language/default_comparisons
In short, one can now do
bool operator == (const MyType & h2) const = default;
auto operator <=> (const MyType & h2) const = default;
And this will work in the vast majority of cases.
This is better than the src/libutil/comparator.hh tricks we did before (predating C++ 20) of deriving those methods based on constructing a std::tuple with all the fields we wanted to compare on the fly.
See the docs on Default comparisons (since C++20) https://en.cppreference.com/w/cpp/language/default_comparisons
In short, one can now do
And this will work in the vast majority of cases.
This is better than the
src/libutil/comparator.hhtricks we did before (predating C++ 20) of deriving those methods based on constructing astd::tuplewith all the fields we wanted to compare on the fly.