tmp/tmprr5122u1/{from.md → to.md}
RENAMED
|
@@ -1,34 +1,39 @@
|
|
| 1 |
### Viable functions <a id="over.match.viable">[[over.match.viable]]</a>
|
| 2 |
|
| 3 |
-
From the set of candidate functions constructed for a given context
|
| 4 |
-
[[over.match.funcs]]
|
| 5 |
the best function will be selected by comparing argument conversion
|
| 6 |
-
sequences
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
First, to be a viable function, a candidate function shall have enough
|
| 11 |
parameters to agree in number with the arguments in the list.
|
| 12 |
|
| 13 |
- If there are *m* arguments in the list, all candidate functions having
|
| 14 |
exactly *m* parameters are viable.
|
| 15 |
- A candidate function having fewer than *m* parameters is viable only
|
| 16 |
-
if it has an ellipsis in its parameter list
|
| 17 |
purposes of overload resolution, any argument for which there is no
|
| 18 |
-
corresponding parameter is considered to “match the ellipsis”
|
| 19 |
-
[[over.ics.ellipsis]]
|
| 20 |
- A candidate function having more than *m* parameters is viable only if
|
| 21 |
-
|
| 22 |
-
[[dcl.fct.default]]
|
| 23 |
parameter list is truncated on the right, so that there are exactly
|
| 24 |
*m* parameters.
|
| 25 |
|
| 26 |
-
Second, for
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
reference to non-`const` cannot be bound to an rvalue and that an rvalue
|
| 32 |
reference cannot be bound to an lvalue can affect the viability of the
|
| 33 |
function (see [[over.ics.ref]]).
|
| 34 |
|
|
|
|
| 1 |
### Viable functions <a id="over.match.viable">[[over.match.viable]]</a>
|
| 2 |
|
| 3 |
+
From the set of candidate functions constructed for a given context
|
| 4 |
+
[[over.match.funcs]], a set of viable functions is chosen, from which
|
| 5 |
the best function will be selected by comparing argument conversion
|
| 6 |
+
sequences and associated constraints [[temp.constr.decl]] for the best
|
| 7 |
+
fit [[over.match.best]]. The selection of viable functions considers
|
| 8 |
+
associated constraints, if any, and relationships between arguments and
|
| 9 |
+
function parameters other than the ranking of conversion sequences.
|
| 10 |
|
| 11 |
First, to be a viable function, a candidate function shall have enough
|
| 12 |
parameters to agree in number with the arguments in the list.
|
| 13 |
|
| 14 |
- If there are *m* arguments in the list, all candidate functions having
|
| 15 |
exactly *m* parameters are viable.
|
| 16 |
- A candidate function having fewer than *m* parameters is viable only
|
| 17 |
+
if it has an ellipsis in its parameter list [[dcl.fct]]. For the
|
| 18 |
purposes of overload resolution, any argument for which there is no
|
| 19 |
+
corresponding parameter is considered to “match the ellipsis”
|
| 20 |
+
[[over.ics.ellipsis]] .
|
| 21 |
- A candidate function having more than *m* parameters is viable only if
|
| 22 |
+
all parameters following the mᵗʰ have default arguments
|
| 23 |
+
[[dcl.fct.default]]. For the purposes of overload resolution, the
|
| 24 |
parameter list is truncated on the right, so that there are exactly
|
| 25 |
*m* parameters.
|
| 26 |
|
| 27 |
+
Second, for a function to be viable, if it has associated constraints
|
| 28 |
+
[[temp.constr.decl]], those constraints shall be satisfied
|
| 29 |
+
[[temp.constr.constr]].
|
| 30 |
+
|
| 31 |
+
Third, for `F` to be a viable function, there shall exist for each
|
| 32 |
+
argument an implicit conversion sequence [[over.best.ics]] that converts
|
| 33 |
+
that argument to the corresponding parameter of `F`. If the parameter
|
| 34 |
+
has reference type, the implicit conversion sequence includes the
|
| 35 |
+
operation of binding the reference, and the fact that an lvalue
|
| 36 |
reference to non-`const` cannot be bound to an rvalue and that an rvalue
|
| 37 |
reference cannot be bound to an lvalue can affect the viability of the
|
| 38 |
function (see [[over.ics.ref]]).
|
| 39 |
|