Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Unary operators act on only one operand in an expression. The unary operators are as follows:
These operators have right-to-left associativity. Unary expressions generally involve syntax that precedes a postfix or primary expression.
Syntax
unary-expression:
postfix-expression
++ cast-expression
-- cast-expression
unary-operator cast-expression
sizeof unary-expression
sizeof ( type-id )
sizeof ... ( identifier )
alignof ( type-id )
noexcept-expression
new-expression
delete-expression
unary-operator: one of
* & + - ! ~
Remarks
Any postfix-expression is considered a unary-expression, and because any primary-expression is considered a postfix-expression, any primary-expression is considered a unary-expression also. For more information, see Postfix expressions and Primary expressions.
The cast-expression is a unary-expression with an optional cast to change the type. For more information, see Cast operator: ().
The noexcept-expression is a noexcept-specifier with a constant-expression argument. For more information, see noexcept.
The new-expression refers to the new operator. The delete-expression refers to the delete operator. For more information, see new operator and delete operator.