tmp/tmp5amf4lcc/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Simple requirements <a id="expr.prim.req.simple">[[expr.prim.req.simple]]</a>
|
| 2 |
+
|
| 3 |
+
``` bnf
|
| 4 |
+
simple-requirement:
|
| 5 |
+
expression ';'
|
| 6 |
+
```
|
| 7 |
+
|
| 8 |
+
A *simple-requirement* asserts the validity of an *expression*.
|
| 9 |
+
|
| 10 |
+
[*Note 1*: The enclosing *requires-expression* will evaluate to `false`
|
| 11 |
+
if substitution of template arguments into the *expression* fails. The
|
| 12 |
+
*expression* is an unevaluated operand [[expr.prop]]. — *end note*]
|
| 13 |
+
|
| 14 |
+
[*Example 1*:
|
| 15 |
+
|
| 16 |
+
``` cpp
|
| 17 |
+
template<typename T> concept C =
|
| 18 |
+
requires (T a, T b) {
|
| 19 |
+
a + b; // C<T> is true if a + b is a valid expression
|
| 20 |
+
};
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
— *end example*]
|
| 24 |
+
|
| 25 |
+
A *requirement* that starts with a `requires` token is never interpreted
|
| 26 |
+
as a *simple-requirement*.
|
| 27 |
+
|
| 28 |
+
[*Note 2*: This simplifies distinguishing between a
|
| 29 |
+
*simple-requirement* and a *nested-requirement*. — *end note*]
|
| 30 |
+
|