Skip to content

4.12. Operator Precedence Table

Table 4.4. Operator Precedence

AssociativityOperatorFunctionUseSee page
Left::Global scope::name286
Left::Class scopeclass::name88
Left::Namespace scopenamespace::name82
Left.Member selectorsobject.member23
Left->Member selectorspointer->member110
Left[]Subscriptexpr[expr]116
Left()Function callname(expr_list)23
Left()Type constructiontype(expr_list)164
Right++Postfix incrementlvalue++147
Right--Postfix decrementlvalue--147
RighttypeidType IDtypeid(type)826
RighttypeidRun-time type IDtypeid(expr)826
Rightcast_nameType conversioncast_name<type>(expr)162
Right++Prefix increment++lvalue147
Right--Prefix decrement--lvalue147
Right~Bitwise NOT~expr152
Right!Logical NOT!expr141
Right-Unary minus-expr140
Right+Unary plus+expr140
Right*Dereference*expr53
Right&Address-of&expr52
Right()Type conversion(type) expr164
RightsizeofSize of objectsizeof expr156
RightsizeofSize of typesizeof(type)156
Rightsizeof...Size of parameter packsizeof...(name)700
RightnewAllocate objectnew type458
Rightnew[]Allocate arraynew type[size]458
RightdeleteDeallocate objectdelete expr460
Rightdelete[]Deallocate arraydelete[] expr460
RightnoexceptCan expr thrownoexcept(expr)780
Left->*Pointer to member selectptr->*ptr_to_member837
Left.*Pointer to member selectobj.*ptr_to_member837
Left*Multiplyexpr * expr139
Left/Divideexpr / expr139
Left%Modulo (remainder)expr % expr139
Left+Addexpr + expr139
Left-Subtractexpr - expr139
Left<<Bitwise shift leftexpr << expr152
Left>>Bitwise shift rightexpr >> expr152
Left<Less thanexpr < expr141
Left<=Less than or equalexpr <= expr141
Left>Greater thanexpr > expr141
Left>=Greater than or equalexpr >= expr141
Left==Equalityexpr == expr141
Left!=Inequalityexpr != expr141
Left&Bitwise ANDexpr & expr152
Left^Bitwise XORexpr ^ expr152
Left|Bitwise ORexpr | expr152
Left&&Logical ANDexpr && expr141
Left||Logical ORexpr || expr141
Right?:Conditionalexpr ? expr : expr151
Right=Assignmentlvalue = expr144
Right*= /- %=Compound assignmentlvalue *= expr lvalue /= expr lvalue %= expr144
Right+= -=Compound assignmentlvalue += expr lvalue -= expr144
Right<<= >>=Compound assignmentlvalue <<= expr lvalue >>= expr144
Right&= |= ^=Compound assignmentlvalue &= expr lvalue |= expr lvalue ^= expr144
RightthrowThrow exceptionthrow expr193
Left,Commaexpr, expr157