[over.binary.general] (original) (raw)

12 Overloading [over]

12.4 Overloaded operators [over.oper]

12.4.3 Binary operators [over.binary]

12.4.3.1 General [over.binary.general]

A binary operator functionis a function named operator@for a binary operator @ that is either a non-static member function ([class.mfct]) with one non-object parameter or a non-member function with two parameters.

For an expression x @ y with subexpressions x and y, the operator function is selected by overload resolution ([over.match.oper]).

If a member function is selected, the expression is interpreted as

x . operator @ ( y )

Otherwise, if a non-member function is selected, the expression is interpreted as

operator @ ( x , y )

An equality operator function is an operator function for an equality operator ([expr.eq]).

A relational operator function is an operator function for a relational operator ([expr.rel]).

A three-way comparison operator function is an operator function for the three-way comparison operator ([expr.spaceship]).

A comparison operator function is an equality operator function, a relational operator function, or a three-way comparison operator function.