three way comparison operator c++ code example
Example: three way comparison operator c++
//Since C++20
lhs <=> rhs
The expression returns an object that
- compares <0 if lhs < rhs
- compares >0 if lhs > rhs
- compares ==0 if lhs and rhs are equal/equivalent.