Comparison operators
From Cppreference
Compares the arguments.
| Operator name | Syntax | Overloadable | Prototype examples (for class T) | |
|---|---|---|---|---|
| Inside class definition | Outside class definition | |||
| equal to | a == b | Yes | bool T::operator ==(const T2 &b) const; | bool operator ==(const T &a, const T2 &b); |
| not equal to | a != b | Yes | bool T::operator !=(const T2 &b) const; | bool operator !=(const T &a, const T2 &b); |
| less than | a < b | Yes | bool T::operator <(const T2 &b) const; | bool operator <(const T &a, const T2 &b); |
| greater than | a > b | Yes | bool T::operator >(const T2 &b) const; | bool operator >(const T &a, const T2 &b); |
| less than or equal to | a <= b | Yes | bool T::operator <=(const T2 &b) const; | bool operator <=(const T &a, const T2 &b); |
| greater than or equal to | a >= b | Yes | bool T::operator >=(const T2 &b) const; | bool operator >=(const T &a, const T2 &b); |
| ||||
[edit] Explanation
Returns the result of comparison of the value of the arguments. They are not modified.
[edit] See also
| Common operators | ||||||
|---|---|---|---|---|---|---|
| assignment | increment decrement |
arithmetic | logical | comparison | member access |
other |
|
a = b |
++a |
+a |
!a |
a == b |
a[b] |
a(...) |
| Special operators | ||||||
|
static_cast converts one type to another compatible type | ||||||