Since your example wants same ordering as the defaulted, you can let the compiler generate the default for you:
1 2 3 4 5 6
struct Integer
{
int i;
long j;
autooperator<=>(const Integer&) const = default;
};
As for your version, we do know that ret == std::strong_ordering::equal is true when ret != std::strong_ordering::equal is false, which makes else more "natural" than a separate if statement.
As you have written, you seem to have:
IF ... THEN return ...
IF ... THEN return ...
end of function
Which makes one ask: "What if both IF are false? There is no return?"
You could write ret != 0. Less typing, but should be equally clear in the context.
Likewise, auto r2 = j <=> other.j; return r2; or return j <=> other.j; ? Style does not make code less or more correct, does it?