tmp/tmp5e8xgu9k/{from.md → to.md}
RENAMED
|
@@ -36,11 +36,11 @@ constraint-logical-and-expression:
|
|
| 36 |
primary-expression
|
| 37 |
constraint-logical-and-expression '&&' primary-expression
|
| 38 |
```
|
| 39 |
|
| 40 |
[*Note 1*: The `>` token following the *template-parameter-list* of a
|
| 41 |
-
*template-declaration*
|
| 42 |
two consecutive `>` tokens [[temp.names]]. — *end note*]
|
| 43 |
|
| 44 |
The *declaration* in a *template-declaration* (if any) shall
|
| 45 |
|
| 46 |
- declare or define a function, a class, or a variable, or
|
|
@@ -76,49 +76,44 @@ struct matrix_constants {
|
|
| 76 |
};
|
| 77 |
```
|
| 78 |
|
| 79 |
— *end example*]
|
| 80 |
|
| 81 |
-
A *template-declaration* can appear only as a namespace
|
| 82 |
-
scope declaration.
|
| 83 |
-
*export-declaration*. In a function template declaration, the last
|
| 84 |
-
component of the *declarator-id* shall not be a *template-id*.
|
| 85 |
|
| 86 |
-
|
| 87 |
-
*
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
| 91 |
|
| 92 |
In a *template-declaration*, explicit specialization, or explicit
|
| 93 |
instantiation the *init-declarator-list* in the declaration shall
|
| 94 |
contain at most one declarator. When such a declaration is used to
|
| 95 |
declare a class template, no declarator is permitted.
|
| 96 |
|
| 97 |
-
A
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
specialization shall not have C linkage. Use of a linkage specification
|
| 102 |
-
other than `"C"` or `"C++"` with any of these constructs is
|
| 103 |
-
conditionally-supported, with *implementation-defined* semantics.
|
| 104 |
-
Template definitions shall obey the one-definition rule
|
| 105 |
-
[[basic.def.odr]].
|
| 106 |
|
| 107 |
-
[*Note
|
| 108 |
functions of class templates are considered definitions for the purpose
|
| 109 |
-
of template instantiation [[temp.decls]] and must
|
| 110 |
-
one-definition rule. — *end note*]
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
[[temp.
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
|
| 121 |
An entity is *templated* if it is
|
| 122 |
|
| 123 |
- a template,
|
| 124 |
- an entity defined [[basic.def]] or created [[class.temporary]] in a
|
|
@@ -126,23 +121,29 @@ An entity is *templated* if it is
|
|
| 126 |
- a member of a templated entity,
|
| 127 |
- an enumerator for an enumeration that is a templated entity, or
|
| 128 |
- the closure type of a *lambda-expression* [[expr.prim.lambda.closure]]
|
| 129 |
appearing in the declaration of a templated entity.
|
| 130 |
|
| 131 |
-
[*Note
|
| 132 |
-
defined in a templated entity is a templated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
A *template-declaration* is written in terms of its template parameters.
|
| 135 |
The optional *requires-clause* following a *template-parameter-list*
|
| 136 |
allows the specification of constraints [[temp.constr.decl]] on template
|
| 137 |
arguments [[temp.arg]]. The *requires-clause* introduces the
|
| 138 |
*constraint-expression* that results from interpreting the
|
| 139 |
*constraint-logical-or-expression* as a *constraint-expression*. The
|
| 140 |
*constraint-logical-or-expression* of a *requires-clause* is an
|
| 141 |
unevaluated operand [[expr.context]].
|
| 142 |
|
| 143 |
-
[*Note
|
| 144 |
|
| 145 |
The expression in a *requires-clause* uses a restricted grammar to avoid
|
| 146 |
ambiguities. Parentheses can be used to specify arbitrary expressions in
|
| 147 |
a *requires-clause*.
|
| 148 |
|
|
|
|
| 36 |
primary-expression
|
| 37 |
constraint-logical-and-expression '&&' primary-expression
|
| 38 |
```
|
| 39 |
|
| 40 |
[*Note 1*: The `>` token following the *template-parameter-list* of a
|
| 41 |
+
*template-declaration* can be the product of replacing a `>>` token by
|
| 42 |
two consecutive `>` tokens [[temp.names]]. — *end note*]
|
| 43 |
|
| 44 |
The *declaration* in a *template-declaration* (if any) shall
|
| 45 |
|
| 46 |
- declare or define a function, a class, or a variable, or
|
|
|
|
| 76 |
};
|
| 77 |
```
|
| 78 |
|
| 79 |
— *end example*]
|
| 80 |
|
| 81 |
+
[*Note 2*: A *template-declaration* can appear only as a namespace
|
| 82 |
+
scope or class scope declaration. — *end note*]
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
Its *declaration* shall not be an *export-declaration*. In a function
|
| 85 |
+
template declaration, the *unqualified-id* of the *declarator-id* shall
|
| 86 |
+
be a name.
|
| 87 |
+
|
| 88 |
+
[*Note 3*: A class or variable template declaration of a
|
| 89 |
+
*simple-template-id* declares a partial specialization
|
| 90 |
+
[[temp.spec.partial]]. — *end note*]
|
| 91 |
|
| 92 |
In a *template-declaration*, explicit specialization, or explicit
|
| 93 |
instantiation the *init-declarator-list* in the declaration shall
|
| 94 |
contain at most one declarator. When such a declaration is used to
|
| 95 |
declare a class template, no declarator is permitted.
|
| 96 |
|
| 97 |
+
A specialization (explicit or implicit) of one template is distinct from
|
| 98 |
+
all specializations of any other template. A template, an explicit
|
| 99 |
+
specialization [[temp.expl.spec]], and a partial specialization shall
|
| 100 |
+
not have C language linkage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
+
[*Note 4*: Default arguments for function templates and for member
|
| 103 |
functions of class templates are considered definitions for the purpose
|
| 104 |
+
of template instantiation [[temp.decls]] and must obey the
|
| 105 |
+
one-definition rule [[basic.def.odr]]. — *end note*]
|
| 106 |
|
| 107 |
+
[*Note 5*: A template cannot have the same name as any other name bound
|
| 108 |
+
in the same scope [[basic.scope.scope]], except that a function template
|
| 109 |
+
can share a name with non-template functions [[dcl.fct]] and/or function
|
| 110 |
+
templates [[temp.over]]. Specializations, including partial
|
| 111 |
+
specializations [[temp.spec.partial]], do not reintroduce or bind names.
|
| 112 |
+
Their target scope is the target scope of the primary template, so all
|
| 113 |
+
specializations of a template belong to the same scope as it
|
| 114 |
+
does. — *end note*]
|
| 115 |
|
| 116 |
An entity is *templated* if it is
|
| 117 |
|
| 118 |
- a template,
|
| 119 |
- an entity defined [[basic.def]] or created [[class.temporary]] in a
|
|
|
|
| 121 |
- a member of a templated entity,
|
| 122 |
- an enumerator for an enumeration that is a templated entity, or
|
| 123 |
- the closure type of a *lambda-expression* [[expr.prim.lambda.closure]]
|
| 124 |
appearing in the declaration of a templated entity.
|
| 125 |
|
| 126 |
+
[*Note 6*: A local class, a local or block variable, or a friend
|
| 127 |
+
function defined in a templated entity is a templated
|
| 128 |
+
entity. — *end note*]
|
| 129 |
+
|
| 130 |
+
A *templated function* is a function template or a function that is
|
| 131 |
+
templated. A *templated class* is a class template or a class that is
|
| 132 |
+
templated. A *templated variable* is a variable template or a variable
|
| 133 |
+
that is templated.
|
| 134 |
|
| 135 |
A *template-declaration* is written in terms of its template parameters.
|
| 136 |
The optional *requires-clause* following a *template-parameter-list*
|
| 137 |
allows the specification of constraints [[temp.constr.decl]] on template
|
| 138 |
arguments [[temp.arg]]. The *requires-clause* introduces the
|
| 139 |
*constraint-expression* that results from interpreting the
|
| 140 |
*constraint-logical-or-expression* as a *constraint-expression*. The
|
| 141 |
*constraint-logical-or-expression* of a *requires-clause* is an
|
| 142 |
unevaluated operand [[expr.context]].
|
| 143 |
|
| 144 |
+
[*Note 7*:
|
| 145 |
|
| 146 |
The expression in a *requires-clause* uses a restricted grammar to avoid
|
| 147 |
ambiguities. Parentheses can be used to specify arbitrary expressions in
|
| 148 |
a *requires-clause*.
|
| 149 |
|