Files
2025-10-25 03:02:53 +03:00

2.8 KiB

[over.ics.user]

12 Overloading [over]

12.2 Overload resolution [over.match]

12.2.4 Best viable function [over.match.best]

12.2.4.2 Implicit conversion sequences [over.best.ics]

12.2.4.2.3 User-defined conversion sequences [over.ics.user]

1

#

A user-defined conversion sequence consists of an initial standard conversion sequence followed by a user-defined conversion ([class.conv]) followed by a second standard conversion sequence.

If the user-defined conversion is specified by a constructor ([class.conv.ctor]), the initial standard conversion sequence converts the source type to the type of the first parameter of that constructor.

If the user-defined conversion is specified by a conversion function, the initial standard conversion sequence converts the source type to the type of the object parameter of that conversion function.

2

#

The second standard conversion sequence converts the result of the user-defined conversion to the target type for the sequence; any reference binding is included in the second standard conversion sequence.

Since an implicit conversion sequence is an initialization, the special rules for initialization by user-defined conversion apply when selecting the best user-defined conversion for a user-defined conversion sequence (see [over.match.best] and [over.best.ics]).

3

#

If the user-defined conversion is specified by a specialization of a conversion function template, the second standard conversion sequence shall have Exact Match rank.

4

#

A conversion of an expression of class type to the same class type is given Exact Match rank, and a conversion of an expression of class type to a base class of that type is given Conversion rank, in spite of the fact that a constructor (i.e., a user-defined conversion function) is called for those cases.