Hacker News new | ask | show | jobs
by claudius 2524 days ago
> Moreover, the compiler can “derive” implementations for regular data objects.

When defaulting the spaceship operator, the same happens for C++ (by comparing members). In this special case, the equality operator is also effectively defaulted, so as described in the article

    struct A {
      …
      auto operator<=>(A const& rhs) const = default;
    };
gives you automatic member-wise comparison "derived" by the compiler.
1 comments

Nice, I missed that.