From Jason Turner

[temp.class]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpg_qs76qv/{from.md → to.md} +10 -8
tmp/tmpg_qs76qv/{from.md → to.md} RENAMED
@@ -159,19 +159,20 @@ v2[3] = dcomplex(7,8); // Array<dcomplex>::operator[]
159
 
160
  — *end example*]
161
 
162
  #### Deduction guides <a id="temp.deduct.guide">[[temp.deduct.guide]]</a>
163
 
164
- Deduction guides are used when a *template-name* appears as a type
165
- specifier for a deduced class type [[dcl.type.class.deduct]]. Deduction
166
- guides are not found by name lookup. Instead, when performing class
167
- template argument deduction [[over.match.class.deduct]], all reachable
168
- deduction guides declared for the class template are considered.
 
169
 
170
  ``` bnf
171
  deduction-guide:
172
- explicit-specifierₒₚₜ template-name '(' parameter-declaration-clause ')' '->' simple-template-id ';'
173
  ```
174
 
175
  [*Example 1*:
176
 
177
  ``` cpp
@@ -190,11 +191,13 @@ S x{A()}; // x is of type S<short, int>
190
  ```
191
 
192
  — *end example*]
193
 
194
  The same restrictions apply to the *parameter-declaration-clause* of a
195
- deduction guide as in a function declaration [[dcl.fct]]. The
 
 
196
  *simple-template-id* shall name a class template specialization. The
197
  *template-name* shall be the same *identifier* as the *template-name* of
198
  the *simple-template-id*. A *deduction-guide* shall inhabit the scope to
199
  which the corresponding class template belongs and, for a member class
200
  template, have the same access. Two deduction guide declarations for the
@@ -271,11 +274,10 @@ class template definition.
271
 
272
  ``` cpp
273
  template<class T> struct A {
274
  enum E : T;
275
  };
276
- A<int> a;
277
  template<class T> enum A<T>::E : T { e1, e2 };
278
  A<int>::E e = A<int>::e1;
279
  ```
280
 
281
  — *end example*]
 
159
 
160
  — *end example*]
161
 
162
  #### Deduction guides <a id="temp.deduct.guide">[[temp.deduct.guide]]</a>
163
 
164
+ Deduction guides are used when a *template-name* or
165
+ *splice-type-specifier* appears as a type specifier for a deduced class
166
+ type [[dcl.type.class.deduct]]. Deduction guides are not found by name
167
+ lookup. Instead, when performing class template argument deduction
168
+ [[over.match.class.deduct]], all reachable deduction guides declared for
169
+ the class template are considered.
170
 
171
  ``` bnf
172
  deduction-guide:
173
+ explicit-specifierₒₚₜ template-name '(' parameter-declaration-clause ')' '->' simple-template-id requires-clauseₒₚₜ ';'
174
  ```
175
 
176
  [*Example 1*:
177
 
178
  ``` cpp
 
191
  ```
192
 
193
  — *end example*]
194
 
195
  The same restrictions apply to the *parameter-declaration-clause* of a
196
+ deduction guide as in a function declaration [[dcl.fct]], except that a
197
+ generic parameter type placeholder [[dcl.spec.auto]] shall not appear in
198
+ the *parameter-declaration-clause* of a deduction guide. The
199
  *simple-template-id* shall name a class template specialization. The
200
  *template-name* shall be the same *identifier* as the *template-name* of
201
  the *simple-template-id*. A *deduction-guide* shall inhabit the scope to
202
  which the corresponding class template belongs and, for a member class
203
  template, have the same access. Two deduction guide declarations for the
 
274
 
275
  ``` cpp
276
  template<class T> struct A {
277
  enum E : T;
278
  };
 
279
  template<class T> enum A<T>::E : T { e1, e2 };
280
  A<int>::E e = A<int>::e1;
281
  ```
282
 
283
  — *end example*]