Before C++20 we had to write 6 comparison operators for our user defined types (or even more). For sure, a tedious task. All this gets simplified with the introduction of the spaceship operator.
What happens to your code, when you turn on “-std=c20” even before we go near the spaceship operator, did your build break? Why does that happen? We will first investigate, another new feature of C20, the rewriting rules, and how that impacts your code base. And then we will dissect the spaceship operator, from a using perspective, and from an implementation perspective. Oh yes, comparison categories, what are those, and why are these important with respect to the spaceship operator? All will be answered, what initially looked so simple, does require some extra thoughts it seems to correctly use the tool.