2 ms·
I don't think this is right. In order to implement <=> for a class, you have to understand strong_ordering, weak_ordering, and partial_ordering in order to pick
by furyofantares 7y ago
I don't think this is right. In order to implement <=> for a class, you have to understand strong_ordering, weak_ordering, and partial_ordering in order to pick one, right?
- slavik81 7y agoGenerally, no. Most of the time you're going to write these functions as defaulted with an auto return type: auto operator<=>(const T&) const = default; bool operator==(const T&) const = default; The compiler will implement the function by comparing all the class member variables and will pick the type of the ordering as appropriate. You only need to look into further details about ordering types if you want to do something fancy.