The ==
, !=
, <
, >
, <=
, >=
, and is
operators are called the relational operators.
The is
operator is described in §7.9.9.
The ==
, !=
, <
, >
, <=
and >=
operators as a group are called the comparison operators. For an operation of the form x
op y
, where op is a comparison operator, overload resolution (§7.2.4) is applied to select a specific operator implementation. The operands are converted to the parameter types of the selected operator, and the type of the result is the return type of the operator.
The predefined comparison operators are described in the following sections. All predefined comparison operators return a result of type bool
, as described in the following table.
Operation | Result |
x == y |
true if x is equal to y , false otherwise |
x != y |
true if x is not equal to y , false otherwise |
x < y |
true if x is less than y , false otherwise |
x > y |
true if x is greater than y , false otherwise |
x <= y |
true if x is less than or equal to y , false otherwise |
x >= y |
true if x is greater than or equal to y , false otherwise |