Operator | Type | Associativity |
:: :: |
binary scope resolution unary scope resolution |
left to right |
() [] . -> ++ -- typeid dynamic_cast<<i> type > static_cast reinterpret_cast const_cast |
parentheses array subscript member selection via object member selection via pointer unary postincrement unary postdecrement run-time type information run-time type-checked cast compile-time type-checked cast cast for non-standard conversions cast away const-ness |
|
++ -- + - ! ~ ( type ) sizeof & * new new[] delete delete[] |
unary preincrement unary predecrement unary plus unary minus unary logical negation unary bitwise complement C-style unary cast determine size in bytes address dereference dynamic memory allocation dynamic array allocation dynamic memory deallocation dynamic array deallocation |
right to left |
left to right | ||
.* ->* |
pointerto member via object pointer to member via pointer |
|
* / % |
multiplication division modulus |
|
+ - |
addition subtraction |
|
<< >> |
bitwise left shift bitwise right shift |
|
< <= > >= |
relational less than relational less than or equal to relational greater than relational greater than or equal to |
|
== != |
relational is equal to relational is not equal to |
|
& | bitwise AND | |
^ | bitwise exclusive OR | |
| | bitwise inclusive OR | |
&& | logical AND | |
|| | logical OR | |
?: | ternary conditional | right to left |
= += -= *= /= %= &= ^= |= >>= <<= |
assignment addition assignment subtraction assignment multiplication assignment division assignment modulus assignment bitwise AND assignment bitwise exclusive OR assignment bitwise inclusive OR assignment bitwise left shift assignment bitwise right shift with assignment |
|
, | comma | left to right |