Consistent Comparison in C++20
Comparison is a ubiquitous operation that we perform when writing code but not everything can be taken for granted. Equality and ordering can sometimes be tricky and there hasn’t been a unified approach to handling them. This changed in C++20 with the adoption of the three-way comparison operator (<=>), also known as the spaceship operator.
This talk will teach you the new consistent ways of writing comparisons.
In this talk you will learn:
theoretical aspects of equivalence, equality, and ordering relationships
guidelines for implementing comparison
what is the new three-way comparison operator in C++20
what are the newly introduced comparison categories and how they relate
how to write the three-way comparison operator for your types