The introduction of a standard attribute [[nocompare]] which can be used to indicate that a suboject of T should be omitted from a defaulted comparison.
struct s {
int id;
[[nocompare]] std::string name;
auto operator<=>(s const&) const = default;
};
Only member 'id' of class 's' will be compared when ordering or testing objects of 's' for equality. This prevents having to define all the relational operators when only wanting to opt-out a single data-member, and it mitigates the user
of having to write dry and error-prone code.
With kind regards,
Joeri Kok