The ==, !=, <, >, <=, >=, is and as operators are called the relational and type-testing operators.
relational-expression:
shift-expression
relational-expression < shift-expression
relational-expression > shift-expression
relational-expression <= shift-expression
relational-expression >= shift-expression
relational-expression is type
relational-expression as type
equality-expression:
relational-expression
equality-expression == relational-expression
equality-expression != relational-expression
The is operator is described in §14.9.10 and the as operator is described in §14.9.11.
The ==, !=, <, >, <= and >= operators are comparison operators. For an operation of the form x op y, where
op is a comparison operator, overload resolution (§14.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. If both operands of an equality-expression have the null type
(§11.2.7) (and hence the null value as well), then overload resolution is not performed and the expression
evaluates to a constant value of true or false according to whether the operator is == or !=.
No comments:
Post a Comment