Spaceship operator in C++

The three-way comparison operator , colloquially called the spaceship operator was added in C++20.

Comparison

Comparison is one of the most commonly used operations in a program. Comparing the built-in types like int's is defined by the language. However, comparison of user-defined types is provided by means of operator overloading.

When we compare objects A and B we are actually calling the operators with parameter. So something like A might evaluate as A.operator. Ofcourse the operator has to ...

 •  0 comments  •  flag
Share on Twitter
Published on March 03, 2021 01:43
No comments have been added yet.