Here we explore:
- how <=> are == differing.
- when to use or not to use the compiler default implementations.
- Being able to overload an operator, especially
==
and<=>
.
- Compile and run the program. We are not fully happy with the default implementation of
<=>
for ourComplex
class, which considers 1|2 as smaller than 1.5|1.5. - Modify it so that the ordering is based on the norm of the complexes.
- Because you do not use any more the default implementation of
<=>
you had to provide also an implementation for==
. What happens if you deduce it from<=>
(using(((*this)<=>other)==0)
) ? - Try to restore the default implementation for
==
only.