|
|
От: | vi.k | |
| Дата: | 31.08.10 05:26 | ||
| Оценка: | |||
NB>Given this first principle, we are left with specifying how well a given argument matches the corresponding parameter of a viable candidate. As a first approximation we can rank the possible matches as follows (from best to worst):
NB>* Perfect match. The parameter has the type of the expression, or it has a type that is a reference to the type of the expression (possibly with added const and/or volatile qualifiers).
NB>* Match with minor adjustments. This includes, for example, the decay of an array variable to a pointer to its first element, or the addition of const to match an argument of type int** to a parameter of type int const* const*.
NB>* Match with promotion. Promotion is a kind of implicit conversion that includes the conversion of small integral types (such as bool, char, short, and sometimes enumerations) to int, unsigned int, long or unsigned long, and the conversion of float to double.
NB>* Match with standard conversions only. This includes any sort of standard conversion (such as int to float) but excludes the implicit call to a conversion operator or a converting constructor.
NB>Match with user-defined conversions. This allows any kind of implicit conversion.
NB>Match with ellipsis. An ellipsis parameter can match almost any type (but non-POD class types result in undefined behavior).