C/C++ Operator Precedence and Associativity

Here is a complete list of the C++ operators in order of decreasing precedence, and with their associativities. The number indicates the precedence and the letter the associativity. Higher numbers indicate higher precedence (tighter binding).

Those operators which cannot be overloaded are so noted; so are the operators whose overloading is somehow 'special'.

OperatorPrecedence and associativityBuilt-in meaningNotes
::20 LeftClass scope qualifier (when used as a binary operator)Cannot be overloaded
::20Global scope qualifier (when used as a unary operator)Cannot be overloaded
()20Parentheses for groupingUnary; cannot be overloaded
[]19 LeftSubscriptingBinary; overloads as member functions only.
()19 LeftFunction callBinary; RHS is the list of arguments. Overloads as member functions only.
()19 LeftType conversion in functional form ('value builder')Binary; LHS is the type; RHS is the list of arguments. Constructors provide overloads; other member overloads are allowed.
.19 LeftMember selection from objectCannot be overloaded. (There are proposals for overloading operator. but they probably won't be accepted.)
->19 LeftMember selection from pointed-at object.Overloadable as member function only.
++19Postfix increment (postincrement).Unary; overload takes an 'unnecessary' argument.
--19Postfix decrement (postdecrement).Unary; overload takes an 'unnecessary' argument.
new18New (memory allocator)Unary or binary; nonassociative. First argument is type; second is list of argument expressions. When overloaded as a member, represented by a static member function.
delete18Delete (memory deallocator)Unary; When overloaded as a member, represented by a static member function. Type is always void.
sizeof17Size of type or objectUnary; returns size_t. Cannot be overloaded.
++17Pre-incrementUnary
--17Pre-decrementUnary
~17Bitwise complementUnary
!17Logical NOTUnary
-17NegativeUnary
+17 Unary, + for symmetry with -. Built-in operator requires operand of arithmetic type; returns value and type of its operand
*17Indirection (Unary)Built-in operator requires pointer type. Complement of &
&17Address-of (Unary)Overloads hide the built-in operator for class, struct, or union types. Members can get pointer as this. If overloaded on an enum, the built-in operator is permanently hidden.
()16Type conversion by cast (prefix)Binary. First operand is type; second is expression to be converted. Can be overloaded when the equivalent functional form conversion can be.
.*15 LeftSelection of member from object using pointer-to-member on the RHSCannot be overloaded. Should a proposal for overloading . be accepted, overloads of .* will probably be accepted as well.
->*15 LeftMember selection from pointed-to object using pointer-to-member on the RHS.Overloadable as a member function only.
*14 LeftMultiplication (Binary) 
/14 LeftDivision 
%14 LeftRemainder 
+13 LeftAddition (Binary) 
-13 LeftSubtraction (Binary) 
<<12 LeftLeft shiftLHS shifted left bitwise by RHS. Undefined if RHS is negative. (The stream I/O system overloads this operator heavily.)
>>12 LeftRight shiftLHS shifted right bitwise by RHS. Undefined if RHS is negative. Shift is arithmetic for signed types, logical for unsigned. (The stream I/O system overloads this operator heavily.)
>11 LeftGreater-than 
<11 LeftLess-than 
>=11 LeftGreater-than or equal to 
<=11 LeftLess-than or equal to 
==10 LeftEqualityCompares the operands; returns 1 if they are equal, zero otherwise.
!=10 LeftInequalityCompares the operands; returns zero if they are equal, 1 otherwise.
&9 LeftBitwise AND (Binary)Built-in requires integral types; returns bit-by-bit AND of operands.
^8 LeftBitwise XORBuilt-in requires integral types; returns bit-by-bit exclusive-or of operands.
|7 LeftBitwise ORBuilt-in requires integral types; returns bit-by-bit inclusive-or of operands.
&&6 LeftLogical (short-circuit) ANDShort-circuit properties do not apply to overloads.
||5 LeftLogical (short-circuit) ORShort-circuit properites do not apply to overloads.
? :4 LeftConditional Expression (Ternary)Cannot be overloaded. C++ permits a conditional to return an lvalue (C does not) and the grammar permits an assignment in both the 'then' and 'else' expressions (C's grammar does not).
throw3 RightThrow an exceptionUnary or nonary. Cannot be overloaded. Optional expression provides the object to be thrown. Right associative in the grammar, but returns void, so the associativity cannot actually be used.
=2 RightAssignmentCan be overloaded as a member only. The built-in assignment operators return a non-const lvalue (in C assignment returns a const rvalue).
/=2 RightCompound assignment:divisionCan be overloaded only as a member.
%=2 RightCompound assignment:remainderCan be overloaded only as a member.
*=2 RightCompound assignment:multiplicationCan be overloaded only as a member.
+=2 RightCompound assignment:additionCan be overloaded only as a member.
-=2 RightCompound assignment:subtractionCan be overloaded only as a member.
<<=2 RightCompound assignment:left shiftCan be overloaded only as a member.
>>=2 RightCompound assignment:right shiftCan be overloaded only as a member.
&=2 RightCompound assignment:bitwise ANDCan be overloaded only as a member.
|=2 RightCompound assignment:bitwise ORCan be overloaded only as a member.
^=2 RightCompound assignment:bitwise XORCan be overloaded only as a member.
,1 LeftComma or voiding operator.When overloaded, the strict left-to-right evaluation property is lost.
source: Mark A. Terribile, Practical C++, 1994, pp 620, McGraw-Hill Inc, ISBN 0-07-063738-5.