tmp/tmpb9znbvid/{from.md → to.md}
RENAMED
|
@@ -1,13 +1,17 @@
|
|
| 1 |
#### Type requirements <a id="expr.prim.req.type">[[expr.prim.req.type]]</a>
|
| 2 |
|
| 3 |
``` bnf
|
| 4 |
type-requirement:
|
| 5 |
typename nested-name-specifierₒₚₜ type-name ';'
|
|
|
|
|
|
|
| 6 |
```
|
| 7 |
|
| 8 |
-
A *type-requirement* asserts the validity of a type.
|
|
|
|
|
|
|
| 9 |
|
| 10 |
[*Note 1*: The enclosing *requires-expression* will evaluate to `false`
|
| 11 |
if substitution of template arguments fails. — *end note*]
|
| 12 |
|
| 13 |
[*Example 1*:
|
|
@@ -16,13 +20,15 @@ if substitution of template arguments fails. — *end note*]
|
|
| 16 |
template<typename T, typename T::type = 0> struct S;
|
| 17 |
template<typename T> using Ref = T&;
|
| 18 |
|
| 19 |
template<typename T> concept C = requires {
|
| 20 |
typename T::inner; // required nested member name
|
| 21 |
-
typename S<T>;
|
| 22 |
-
|
| 23 |
typename Ref<T>; // required alias template substitution, fails if T is void
|
|
|
|
|
|
|
| 24 |
};
|
| 25 |
```
|
| 26 |
|
| 27 |
— *end example*]
|
| 28 |
|
|
|
|
| 1 |
#### Type requirements <a id="expr.prim.req.type">[[expr.prim.req.type]]</a>
|
| 2 |
|
| 3 |
``` bnf
|
| 4 |
type-requirement:
|
| 5 |
typename nested-name-specifierₒₚₜ type-name ';'
|
| 6 |
+
typename splice-specifier
|
| 7 |
+
typename splice-specialization-specifier
|
| 8 |
```
|
| 9 |
|
| 10 |
+
A *type-requirement* asserts the validity of a type. The component names
|
| 11 |
+
of a *type-requirement* are those of its *nested-name-specifier* (if
|
| 12 |
+
any) and *type-name* (if any).
|
| 13 |
|
| 14 |
[*Note 1*: The enclosing *requires-expression* will evaluate to `false`
|
| 15 |
if substitution of template arguments fails. — *end note*]
|
| 16 |
|
| 17 |
[*Example 1*:
|
|
|
|
| 20 |
template<typename T, typename T::type = 0> struct S;
|
| 21 |
template<typename T> using Ref = T&;
|
| 22 |
|
| 23 |
template<typename T> concept C = requires {
|
| 24 |
typename T::inner; // required nested member name
|
| 25 |
+
typename S<T>; // required valid[temp.names] template-id; fails if T::type does not exist as a type
|
| 26 |
+
// to which 0 can be implicitly converted
|
| 27 |
typename Ref<T>; // required alias template substitution, fails if T is void
|
| 28 |
+
typename [:T::r1:]; // fails if T::r1 is not a reflection of a type
|
| 29 |
+
typename [:T::r2:]<int>; // fails if T::r2 is not a reflection of a template Z for which Z<int> is a type
|
| 30 |
};
|
| 31 |
```
|
| 32 |
|
| 33 |
— *end example*]
|
| 34 |
|