Skip to content

Remove comparator.hh and use new C++ comparison operator defaulting #10832

@Ericson2314

Description

@Ericson2314

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions