Table of operators

Operator          Number of parameters                 Remarks
         (including object for member functions)

  ()           undetermined      You must use a member function.
  []                 2           You must use a member function.

  ->                 2           You must use a member function.
                                 Overload it only if really needed.

  new delete         1           For a class, use as member function
                                   (then they are automaticaly static).
                                 Can be globally defined.

  ++ --              1           Pre-decrementation.
  ++ --        2 (2nd unused)    Post-decrementation (2nd argument is
                                   of type int and unused, to make
                                   the choice between post- and pre-).

  &                  1           Pre-defined (return "this").
                                 Overload it only if really needed.

  + - ! ~ *          1
  (cast)             1           See description below.

  * / % + -          2
  << >>              2
  < <= > == !=       2
  & ^ || && |        2
  =                  2           Pre-defined (member copy).
                                 You must use a member function.

  += -= *= /= %=     2
  &= ^= |= <<= >>=   2

  ,                  2

Back to operators.


C++