three-way comparison c++ code example
Example: three-way comparison c++
lhs <=> rhs //Since C++20
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.
lhs <=> rhs //Since C++20
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.