6.6.1. Argument Type Conversions

Image

In order to determine the best match, the compiler ranks the conversions that could be used to convert each argument to the type of its corresponding parameter. Conversions are ranked as follows:

1. An exact match. An exact match happens when:

• The argument and parameter types are identical.

• The argument is converted from an array or function type to the corresponding pointer type. (§ 6.7 (p. 247) covers function pointers.)

• A top-level const is added to or discarded from the argument.

2. Match through a const conversion (§ 4.11.2, p. 162).

3. Match through a promotion (§ 4.11.1, p. 160).

4. Match through ...

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.