14.9.3. Function Matching and Overloaded Operators
Overloaded operators are overloaded functions. Normal function matching (§ 6.4, p. 233) is used to determine which operator—built-in or overloaded—to apply to a given expression. However, when an operator function is used in an expression, the set of candidate functions is broader than when we call a function using the call operator. If a
has a class type, the expression a
sym b
might be
a.operatorsym (b); // a has operatorsym as a member functionoperatorsym(a, b); // operatorsym is an ordinary function
Unlike ordinary function calls, we cannot use the form of the call to distinquish whether ...
Get C++ Primer, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.