| Operator | Assoc. | Meaning |
|---|---|---|
| Precedence Group 1 | ||
| :: | Scope resolution operator | |
| Precedence Group 2 | ||
| (expression) | Grouping | |
| () | L–R | Function call |
| () | Value construction—that is, type (expr) | |
| [] | Array subscript | |
| . | Direct membership operator | |
| -> | Indirect membership operator | |
| ++ | Increment operator, postfix | |
| – | Decrement operator, postfix | |
| const_cast | Specialized type cast | |
| dynamic_cast | Specialized type cast | |
| reinterpret_cast | Specialized type cast | |
| static_cast | Specialized type cast | |
| typeid | Type identification | |
| Precedence Group 3 (All Unary) | ||
| ! | R–L | Logical negation |
| ~ | Bitwise negation | |
| + | Unary plus (positive sign) | |
| - | Unary minus (negative sign) | |
| ++ | Increment operator, prefix | |
| – | Decrement operator, prefix | |
| & | Address | |
| * | Dereference (indirect value) | |
| () | Type cast—that is, (type) expr | |
| sizeof | Size in bytes | |
| alignof | Alignment requirement | |
| new | Dynamically allocate storage | |
| new [] | Dynamically allocate array | |
| delete | Dynamically free storage | |
| delete [] | Dynamically free array | |
| noexcept | False if operand might throw an exception | |
| Precedence Group 4 | ||
| .* | L–R | Member dereference |
| ->* | Indirect member dereference | |
| Precedence Group 5 (All Binary) | ||
| * | L–R | Multiply |
| / | Divide | |
| % | Modulus (remainder) | |
| Precedence Group 6 (All Binary) | ||
| + | L–R | Addition |
| - | Subtraction | |
| Precedence Group 7 | ||
| << | L–R | Left shift |
| >> | Right shift | |
| Precedence Group 8 | ||
| < | L–R | Less than |
| <= | Less than or equal to | |
| >= | Greater than or equal to | |
| > | Greater than | |
| Precedence Group 9 | ||
| == | L–R | Equal to |
| != | Not equal to | |
| Precedence Group 10 (Binary) | ||
| & | L–R | Bitwise AND |
| Precedence Group 11 | ||
| ^ | L–R | Bitwise XOR (exclusive OR) |
| Precedence Group 12 | ||
| | | L–R | Bitwise OR |
| Precedence Group 13 | ||
| && | L–R | Logical AND |
| Precedence Group 14 | ||
| || | L–R | Logical OR |
| Precedence Group 15 | ||
| :? | R–L | Conditional |
| Precedence Group 16 | ||
| = | R–L | Simple assignment |
| *= | Multiply and assign | |
| /= | Divide and assign | |
| %= | Take remainder and assign | |
| += | Add and assign | |
| -= | Subtract and assign | |
| &= | Bitwise AND and assign | |
| ^= | Bitwise XOR and assign | |
| |= | Bitwise OR and assign | |
| <<= | Left shift and assign | |
| >>= | Right shift and assig | |
| Precedence Group 17 | ||
| throw | L–R | Throw exception |
| Precedence Group 18 | ||
| , | L–R | Combine two expressions into one |
此为本人读C++ Primer总结的笔记,如有错误或知识缺口,请在评论区告知。如本文有在实践中帮到您,是本人的荣幸。