From Jason Turner

[temp.deduct.partial]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpsw1soy8c/{from.md → to.md} +14 -17
tmp/tmpsw1soy8c/{from.md → to.md} RENAMED
@@ -20,21 +20,19 @@ as the parameter template.
20
 
21
  The types used to determine the ordering depend on the context in which
22
  the partial ordering is done:
23
 
24
  - In the context of a function call, the types used are those function
25
- parameter types for which the function call has arguments.[^7]
26
  - In the context of a call to a conversion function, the return types of
27
  the conversion function templates are used.
28
- - In other contexts ([[temp.func.order]]) the function template’s
29
- function type is used.
30
 
31
  Each type nominated above from the parameter template and the
32
  corresponding type from the argument template are used as the types of
33
- `P` and `A`. If a particular `P` contains no *template-parameter*s that
34
- participate in template argument deduction, that `P` is not used to
35
- determine the ordering.
36
 
37
  Before the partial ordering is done, certain transformations are
38
  performed on the types used for partial ordering:
39
 
40
  - If `P` is a reference type, `P` is replaced by the type referred to.
@@ -78,14 +76,13 @@ f(1, 2); // calls #3; non-variadic template #3 is more specialized
78
  // than the variadic templates #1 and #2
79
  ```
80
 
81
  — *end example*]
82
 
83
- If, for a given type, deduction succeeds in both directions (i.e., the
84
- types are identical after the transformations above) and both `P` and
85
- `A` were reference types (before being replaced with the type referred
86
- to above):
87
 
88
  - if the type from the argument template was an lvalue reference and the
89
  type from the parameter template was not, the parameter type is not
90
  considered to be at least as specialized as the argument type;
91
  otherwise,
@@ -100,18 +97,18 @@ from `F` is at least as specialized as the type from `G`. `F` is *more
100
  specialized than* `G` if `F` is at least as specialized as `G` and `G`
101
  is not at least as specialized as `F`.
102
 
103
  If, after considering the above, function template `F` is at least as
104
  specialized as function template `G` and vice-versa, and if `G` has a
105
- trailing parameter pack for which `F` does not have a corresponding
106
- parameter, and if `F` does not have a trailing parameter pack, then `F`
107
- is more specialized than `G`.
108
 
109
- In most cases, all template parameters must have values in order for
110
- deduction to succeed, but for partial ordering purposes a template
111
- parameter may remain without a value provided it is not used in the
112
- types being used for partial ordering.
113
 
114
  [*Note 2*: A template parameter used in a non-deduced context is
115
  considered used. — *end note*]
116
 
117
  [*Example 2*:
 
20
 
21
  The types used to determine the ordering depend on the context in which
22
  the partial ordering is done:
23
 
24
  - In the context of a function call, the types used are those function
25
+ parameter types for which the function call has arguments.[^12]
26
  - In the context of a call to a conversion function, the return types of
27
  the conversion function templates are used.
28
+ - In other contexts [[temp.func.order]] the function template’s function
29
+ type is used.
30
 
31
  Each type nominated above from the parameter template and the
32
  corresponding type from the argument template are used as the types of
33
+ `P` and `A`.
 
 
34
 
35
  Before the partial ordering is done, certain transformations are
36
  performed on the types used for partial ordering:
37
 
38
  - If `P` is a reference type, `P` is replaced by the type referred to.
 
76
  // than the variadic templates #1 and #2
77
  ```
78
 
79
  — *end example*]
80
 
81
+ If, for a given type, the types are identical after the transformations
82
+ above and both `P` and `A` were reference types (before being replaced
83
+ with the type referred to above):
 
84
 
85
  - if the type from the argument template was an lvalue reference and the
86
  type from the parameter template was not, the parameter type is not
87
  considered to be at least as specialized as the argument type;
88
  otherwise,
 
97
  specialized than* `G` if `F` is at least as specialized as `G` and `G`
98
  is not at least as specialized as `F`.
99
 
100
  If, after considering the above, function template `F` is at least as
101
  specialized as function template `G` and vice-versa, and if `G` has a
102
+ trailing function parameter pack for which `F` does not have a
103
+ corresponding parameter, and if `F` does not have a trailing function
104
+ parameter pack, then `F` is more specialized than `G`.
105
 
106
+ In most cases, deduction fails if not all template parameters have
107
+ values, but for partial ordering purposes a template parameter may
108
+ remain without a value provided it is not used in the types being used
109
+ for partial ordering.
110
 
111
  [*Note 2*: A template parameter used in a non-deduced context is
112
  considered used. — *end note*]
113
 
114
  [*Example 2*: