tmp/tmpo26emfih/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="temp.dep.general">[[temp.dep.general]]</a>
|
| 2 |
+
|
| 3 |
+
Inside a template, some constructs have semantics which may differ from
|
| 4 |
+
one instantiation to another. Such a construct *depends* on the template
|
| 5 |
+
parameters. In particular, types and expressions may depend on the type
|
| 6 |
+
and/or value of template parameters (as determined by the template
|
| 7 |
+
arguments) and this determines the context for name lookup for certain
|
| 8 |
+
names. An expression may be *type-dependent* (that is, its type may
|
| 9 |
+
depend on a template parameter) or *value-dependent* (that is, its value
|
| 10 |
+
when evaluated as a constant expression [[expr.const]] may depend on a
|
| 11 |
+
template parameter) as described below.
|
| 12 |
+
|
| 13 |
+
A *dependent call* is an expression, possibly formed as a non-member
|
| 14 |
+
candidate for an operator [[over.match.oper]], of the form:
|
| 15 |
+
|
| 16 |
+
``` bnf
|
| 17 |
+
postfix-expression '(' expression-listₒₚₜ ')'
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
where the *postfix-expression* is an *unqualified-id* and
|
| 21 |
+
|
| 22 |
+
- any of the expressions in the *expression-list* is a pack expansion
|
| 23 |
+
[[temp.variadic]], or
|
| 24 |
+
- any of the expressions or *braced-init-list*s in the *expression-list*
|
| 25 |
+
is type-dependent [[temp.dep.expr]], or
|
| 26 |
+
- the *unqualified-id* is a *template-id* in which any of the template
|
| 27 |
+
arguments depends on a template parameter.
|
| 28 |
+
|
| 29 |
+
The component name of an *unqualified-id* [[expr.prim.id.unqual]] is
|
| 30 |
+
dependent if
|
| 31 |
+
|
| 32 |
+
- it is a *conversion-function-id* whose *conversion-type-id* is
|
| 33 |
+
dependent, or
|
| 34 |
+
- it is `operator=` and the current class is a templated entity, or
|
| 35 |
+
- the *unqualified-id* is the *postfix-expression* in a dependent call.
|
| 36 |
+
|
| 37 |
+
[*Note 1*: Such names are looked up only at the point of the template
|
| 38 |
+
instantiation [[temp.point]] in both the context of the template
|
| 39 |
+
definition and the context of the point of instantiation
|
| 40 |
+
[[temp.dep.candidate]]. — *end note*]
|
| 41 |
+
|
| 42 |
+
[*Example 1*:
|
| 43 |
+
|
| 44 |
+
``` cpp
|
| 45 |
+
template<class T> struct X : B<T> {
|
| 46 |
+
typename T::A* pa;
|
| 47 |
+
void f(B<T>* pb) {
|
| 48 |
+
static int i = B<T>::i;
|
| 49 |
+
pb->j++;
|
| 50 |
+
}
|
| 51 |
+
};
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
The base class name `B<T>`, the type name `T::A`, the names `B<T>::i`
|
| 55 |
+
and `pb->j` explicitly depend on the *template-parameter*.
|
| 56 |
+
|
| 57 |
+
— *end example*]
|
| 58 |
+
|