Solution: Extend MyInt Class
The solution to the challenge, 'Exercise: Extend MyInt Class'.
We'll cover the following...
We'll cover the following...
Solution
I defined the three-way comparison operator (line 8) and declared it constexpr. The user-defined three-way comparison operator is not implicitly constexpr, unlike the compiler-generated three-way comparison operator. The comparison of MyInt and int is possible in each combination (lines 30, 33, and 36).
Honestly, the implementation of the various three-way comparison operators is very elegant. The compiler auto-generates the comparison of MyInt ...