Exactly the question above. I was reading about std::pair on cppreference where the following was written:
operator== operator!= // (removed in C++20) operator< // (removed in C++20) operator<= // (removed in C++20) operator> // (removed in C++20) operator>= // (removed in C++20) operator<=> // (C++20)
To verify this, I have written the following code, which seems to be running perfectly on the latest gcc compiler, whereas I expected a syntax error from the compiler, so what does cppreference mean by writing removed in C++20 for operator !=?
The clue is in what was added in C++20, i.e. the
<=>operator.<=>is the three-way comparison operator, also known as the spaceship operator. Its purpose is to define all types of equality comparisons (<,>=,!=, and so on) as a single function.Since the other comparison operators are implicitly provided using the three-way comparison operator, the individual operator implementations are no longer needed and have been removed.
EDIT:
Turns out I'm completely wrong here.
a != bisn't rewritten to usea <=> b; it's rewritten to use!(a == b); see answer to the question that this is marked as a duplicate of.