tmp/tmps3vsu5m1/{from.md → to.md}
RENAMED
|
@@ -123,25 +123,25 @@ The `for` statement
|
|
| 123 |
```
|
| 124 |
|
| 125 |
is equivalent to
|
| 126 |
|
| 127 |
except that names declared in the *for-init-statement* are in the same
|
| 128 |
-
declarative
|
| 129 |
a `continue` in *statement* (not enclosed in another iteration
|
| 130 |
statement) will execute *expression* before re-evaluating *condition*.
|
| 131 |
Thus the first statement specifies initialization for the loop; the
|
| 132 |
condition ([[stmt.select]]) specifies a test, made before each
|
| 133 |
iteration, such that the loop is exited when the condition becomes
|
| 134 |
`false`; the expression often specifies incrementing that is done after
|
| 135 |
each iteration.
|
| 136 |
|
| 137 |
Either or both of the condition and the expression can be omitted. A
|
| 138 |
-
missing *condition* makes the implied `while`
|
| 139 |
`while(true)`.
|
| 140 |
|
| 141 |
If the *for-init-statement* is a declaration, the scope of the name(s)
|
| 142 |
-
declared extends to the end of the
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
int i = 42;
|
| 146 |
int a[10];
|
| 147 |
|
|
@@ -200,19 +200,19 @@ exposition only, and `_RangeT` is the type of the *expression*, and
|
|
| 200 |
are looked up in the scope of class `\mbox{_RangeT}` as if by class
|
| 201 |
member access lookup ([[basic.lookup.classref]]), and if either (or
|
| 202 |
both) finds at least one declaration, *begin-expr* and *end-expr* are
|
| 203 |
`__range.begin()` and `__range.end()`, respectively;
|
| 204 |
- otherwise, *begin-expr* and *end-expr* are `begin(__range)` and
|
| 205 |
-
`end(__range)`, respectively, where `begin` and `end` are looked up
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
namespace.
|
| 209 |
|
| 210 |
``` cpp
|
| 211 |
int array[5] = { 1, 2, 3, 4, 5 };
|
| 212 |
for (int& x : array)
|
| 213 |
x *= 2;
|
| 214 |
```
|
| 215 |
|
| 216 |
In the *decl-specifier-seq* of a *for-range-declaration*, each
|
| 217 |
-
*decl-specifier* shall be either a *type-specifier* or `constexpr`.
|
|
|
|
| 218 |
|
|
|
|
| 123 |
```
|
| 124 |
|
| 125 |
is equivalent to
|
| 126 |
|
| 127 |
except that names declared in the *for-init-statement* are in the same
|
| 128 |
+
declarative region as those declared in the *condition*, and except that
|
| 129 |
a `continue` in *statement* (not enclosed in another iteration
|
| 130 |
statement) will execute *expression* before re-evaluating *condition*.
|
| 131 |
Thus the first statement specifies initialization for the loop; the
|
| 132 |
condition ([[stmt.select]]) specifies a test, made before each
|
| 133 |
iteration, such that the loop is exited when the condition becomes
|
| 134 |
`false`; the expression often specifies incrementing that is done after
|
| 135 |
each iteration.
|
| 136 |
|
| 137 |
Either or both of the condition and the expression can be omitted. A
|
| 138 |
+
missing *condition* makes the implied `while` clause equivalent to
|
| 139 |
`while(true)`.
|
| 140 |
|
| 141 |
If the *for-init-statement* is a declaration, the scope of the name(s)
|
| 142 |
+
declared extends to the end of the `for` statement.
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
int i = 42;
|
| 146 |
int a[10];
|
| 147 |
|
|
|
|
| 200 |
are looked up in the scope of class `\mbox{_RangeT}` as if by class
|
| 201 |
member access lookup ([[basic.lookup.classref]]), and if either (or
|
| 202 |
both) finds at least one declaration, *begin-expr* and *end-expr* are
|
| 203 |
`__range.begin()` and `__range.end()`, respectively;
|
| 204 |
- otherwise, *begin-expr* and *end-expr* are `begin(__range)` and
|
| 205 |
+
`end(__range)`, respectively, where `begin` and `end` are looked up in
|
| 206 |
+
the associated namespaces ([[basic.lookup.argdep]]). Ordinary
|
| 207 |
+
unqualified lookup ([[basic.lookup.unqual]]) is not performed.
|
|
|
|
| 208 |
|
| 209 |
``` cpp
|
| 210 |
int array[5] = { 1, 2, 3, 4, 5 };
|
| 211 |
for (int& x : array)
|
| 212 |
x *= 2;
|
| 213 |
```
|
| 214 |
|
| 215 |
In the *decl-specifier-seq* of a *for-range-declaration*, each
|
| 216 |
+
*decl-specifier* shall be either a *type-specifier* or `constexpr`. The
|
| 217 |
+
*decl-specifier-seq* shall not define a class or enumeration.
|
| 218 |
|