tmp/tmpeoj6gk27/{from.md → to.md}
RENAMED
|
@@ -1,36 +1,36 @@
|
|
| 1 |
-
## Explicit type conversion (cast notation) <a id="expr.cast">[[expr.cast]]</a>
|
| 2 |
|
| 3 |
The result of the expression `(T)` *cast-expression* is of type `T`. The
|
| 4 |
result is an lvalue if `T` is an lvalue reference type or an rvalue
|
| 5 |
reference to function type and an xvalue if `T` is an rvalue reference
|
| 6 |
to object type; otherwise the result is a prvalue.
|
| 7 |
|
| 8 |
[*Note 1*: If `T` is a non-class type that is cv-qualified, the
|
| 9 |
*cv-qualifier*s are discarded when determining the type of the resulting
|
| 10 |
-
prvalue; see
|
| 11 |
|
| 12 |
-
An explicit type conversion can be expressed using functional notation
|
| 13 |
-
[[expr.type.conv]]
|
| 14 |
`static_cast`, `reinterpret_cast`, `const_cast`), or the *cast*
|
| 15 |
notation.
|
| 16 |
|
| 17 |
``` bnf
|
| 18 |
cast-expression:
|
| 19 |
unary-expression
|
| 20 |
'(' type-id ')' cast-expression
|
| 21 |
```
|
| 22 |
|
| 23 |
Any type conversion not mentioned below and not explicitly defined by
|
| 24 |
-
the user
|
| 25 |
|
| 26 |
The conversions performed by
|
| 27 |
|
| 28 |
-
- a `const_cast`
|
| 29 |
-
- a `static_cast`
|
| 30 |
- a `static_cast` followed by a `const_cast`,
|
| 31 |
-
- a `reinterpret_cast`
|
| 32 |
- a `reinterpret_cast` followed by a `const_cast`,
|
| 33 |
|
| 34 |
can be performed using the cast notation of explicit type conversion.
|
| 35 |
The same semantic restrictions and behaviors apply, with the exception
|
| 36 |
that in performing a `static_cast` in the following situations the
|
|
|
|
| 1 |
+
### Explicit type conversion (cast notation) <a id="expr.cast">[[expr.cast]]</a>
|
| 2 |
|
| 3 |
The result of the expression `(T)` *cast-expression* is of type `T`. The
|
| 4 |
result is an lvalue if `T` is an lvalue reference type or an rvalue
|
| 5 |
reference to function type and an xvalue if `T` is an rvalue reference
|
| 6 |
to object type; otherwise the result is a prvalue.
|
| 7 |
|
| 8 |
[*Note 1*: If `T` is a non-class type that is cv-qualified, the
|
| 9 |
*cv-qualifier*s are discarded when determining the type of the resulting
|
| 10 |
+
prvalue; see [[expr.prop]]. — *end note*]
|
| 11 |
|
| 12 |
+
An explicit type conversion can be expressed using functional notation
|
| 13 |
+
[[expr.type.conv]], a type conversion operator (`dynamic_cast`,
|
| 14 |
`static_cast`, `reinterpret_cast`, `const_cast`), or the *cast*
|
| 15 |
notation.
|
| 16 |
|
| 17 |
``` bnf
|
| 18 |
cast-expression:
|
| 19 |
unary-expression
|
| 20 |
'(' type-id ')' cast-expression
|
| 21 |
```
|
| 22 |
|
| 23 |
Any type conversion not mentioned below and not explicitly defined by
|
| 24 |
+
the user [[class.conv]] is ill-formed.
|
| 25 |
|
| 26 |
The conversions performed by
|
| 27 |
|
| 28 |
+
- a `const_cast` [[expr.const.cast]],
|
| 29 |
+
- a `static_cast` [[expr.static.cast]],
|
| 30 |
- a `static_cast` followed by a `const_cast`,
|
| 31 |
+
- a `reinterpret_cast` [[expr.reinterpret.cast]], or
|
| 32 |
- a `reinterpret_cast` followed by a `const_cast`,
|
| 33 |
|
| 34 |
can be performed using the cast notation of explicit type conversion.
|
| 35 |
The same semantic restrictions and behaviors apply, with the exception
|
| 36 |
that in performing a `static_cast` in the following situations the
|