tmp/tmpfby2822y/{from.md → to.md}
RENAMED
|
@@ -1,28 +1,26 @@
|
|
| 1 |
### The `switch` statement <a id="stmt.switch">[[stmt.switch]]</a>
|
| 2 |
|
| 3 |
The `switch` statement causes control to be transferred to one of
|
| 4 |
several statements depending on the value of a condition.
|
| 5 |
|
| 6 |
-
The condition shall be of integral type, enumeration type, or
|
| 7 |
-
type
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
with one or more case labels as follows:
|
| 14 |
|
| 15 |
``` bnf
|
| 16 |
'case' constant-expression ':'
|
| 17 |
```
|
| 18 |
|
| 19 |
where the *constant-expression* shall be a converted constant
|
| 20 |
-
expression ([[expr.const]]) of the
|
| 21 |
condition. No two of the case constants in the same switch shall have
|
| 22 |
-
the same value after conversion
|
| 23 |
-
condition.
|
| 24 |
|
| 25 |
There shall be at most one label of the form
|
| 26 |
|
| 27 |
``` cpp
|
| 28 |
default :
|
|
|
|
| 1 |
### The `switch` statement <a id="stmt.switch">[[stmt.switch]]</a>
|
| 2 |
|
| 3 |
The `switch` statement causes control to be transferred to one of
|
| 4 |
several statements depending on the value of a condition.
|
| 5 |
|
| 6 |
+
The condition shall be of integral type, enumeration type, or class
|
| 7 |
+
type. If of class type, the condition is contextually implicitly
|
| 8 |
+
converted (Clause [[conv]]) to an integral or enumeration type. If the
|
| 9 |
+
(possibly converted) type is subject to integral promotions (
|
| 10 |
+
[[conv.prom]]), the condition is converted to the promoted type. Any
|
| 11 |
+
statement within the `switch` statement can be labeled with one or more
|
| 12 |
+
case labels as follows:
|
|
|
|
| 13 |
|
| 14 |
``` bnf
|
| 15 |
'case' constant-expression ':'
|
| 16 |
```
|
| 17 |
|
| 18 |
where the *constant-expression* shall be a converted constant
|
| 19 |
+
expression ([[expr.const]]) of the adjusted type of the switch
|
| 20 |
condition. No two of the case constants in the same switch shall have
|
| 21 |
+
the same value after conversion.
|
|
|
|
| 22 |
|
| 23 |
There shall be at most one label of the form
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
default :
|