tmp/tmp55_lwdxn/{from.md → to.md}
RENAMED
|
@@ -38,39 +38,37 @@ A value of integral type or enumeration type can be explicitly converted
|
|
| 38 |
to a pointer. A pointer converted to an integer of sufficient size (if
|
| 39 |
any such exists on the implementation) and back to the same pointer type
|
| 40 |
will have its original value; mappings between pointers and integers are
|
| 41 |
otherwise *implementation-defined*.
|
| 42 |
|
| 43 |
-
[*Note 4*: Except as described in [[basic.stc.dynamic.safety]], the
|
| 44 |
-
result of such a conversion will not be a safely-derived pointer
|
| 45 |
-
value. — *end note*]
|
| 46 |
-
|
| 47 |
A function pointer can be explicitly converted to a function pointer of
|
| 48 |
a different type.
|
| 49 |
|
| 50 |
-
[*Note
|
| 51 |
function type [[dcl.fct]] that is not the same as the type used in the
|
| 52 |
definition of the function is undefined [[expr.call]]. — *end note*]
|
| 53 |
|
| 54 |
Except that converting a prvalue of type “pointer to `T1`” to the type
|
| 55 |
“pointer to `T2`” (where `T1` and `T2` are function types) and back to
|
| 56 |
its original type yields the original pointer value, the result of such
|
| 57 |
a pointer conversion is unspecified.
|
| 58 |
|
| 59 |
-
[*Note
|
| 60 |
conversions. — *end note*]
|
| 61 |
|
| 62 |
An object pointer can be explicitly converted to an object pointer of a
|
| 63 |
-
different type.[^17]
|
| 64 |
-
|
|
|
|
|
|
|
| 65 |
`static_cast<cv T*>(static_cast<cv~void*>(v))`.
|
| 66 |
|
| 67 |
-
[*Note
|
| 68 |
-
“pointer to `T2`” (where `
|
| 69 |
-
alignment requirements of `T2` are no stricter
|
| 70 |
-
back to its original type yields the original
|
| 71 |
-
value. — *end note*]
|
| 72 |
|
| 73 |
Converting a function pointer to an object pointer type or vice versa is
|
| 74 |
conditionally-supported. The meaning of such a conversion is
|
| 75 |
*implementation-defined*, except that if an implementation supports
|
| 76 |
conversions in both directions, converting a prvalue of one type to the
|
|
@@ -78,21 +76,23 @@ other type and back, possibly with different cv-qualification, shall
|
|
| 78 |
yield the original pointer value.
|
| 79 |
|
| 80 |
The null pointer value [[basic.compound]] is converted to the null
|
| 81 |
pointer value of the destination type.
|
| 82 |
|
| 83 |
-
[*Note
|
| 84 |
converted to a pointer type, and a null pointer constant of integral
|
| 85 |
type is not necessarily converted to a null pointer
|
| 86 |
value. — *end note*]
|
| 87 |
|
| 88 |
A prvalue of type “pointer to member of `X` of type `T1`” can be
|
| 89 |
explicitly converted to a prvalue of a different type “pointer to member
|
| 90 |
of `Y` of type `T2`” if `T1` and `T2` are both function types or both
|
| 91 |
-
object types.[^18]
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
| 94 |
|
| 95 |
- Converting a prvalue of type “pointer to member function” to a
|
| 96 |
different pointer-to-member-function type and back to its original
|
| 97 |
type yields the original pointer-to-member value.
|
| 98 |
- Converting a prvalue of type “pointer to data member of `X` of type
|
|
|
|
| 38 |
to a pointer. A pointer converted to an integer of sufficient size (if
|
| 39 |
any such exists on the implementation) and back to the same pointer type
|
| 40 |
will have its original value; mappings between pointers and integers are
|
| 41 |
otherwise *implementation-defined*.
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
A function pointer can be explicitly converted to a function pointer of
|
| 44 |
a different type.
|
| 45 |
|
| 46 |
+
[*Note 4*: The effect of calling a function through a pointer to a
|
| 47 |
function type [[dcl.fct]] that is not the same as the type used in the
|
| 48 |
definition of the function is undefined [[expr.call]]. — *end note*]
|
| 49 |
|
| 50 |
Except that converting a prvalue of type “pointer to `T1`” to the type
|
| 51 |
“pointer to `T2`” (where `T1` and `T2` are function types) and back to
|
| 52 |
its original type yields the original pointer value, the result of such
|
| 53 |
a pointer conversion is unspecified.
|
| 54 |
|
| 55 |
+
[*Note 5*: See also [[conv.ptr]] for more details of pointer
|
| 56 |
conversions. — *end note*]
|
| 57 |
|
| 58 |
An object pointer can be explicitly converted to an object pointer of a
|
| 59 |
+
different type.[^17]
|
| 60 |
+
|
| 61 |
+
When a prvalue `v` of object pointer type is converted to the object
|
| 62 |
+
pointer type “pointer to cv `T`”, the result is
|
| 63 |
`static_cast<cv T*>(static_cast<cv~void*>(v))`.
|
| 64 |
|
| 65 |
+
[*Note 6*: Converting a pointer of type “pointer to `T1`” that points
|
| 66 |
+
to an object of type `T1` to the type “pointer to `T2`” (where `T2` is
|
| 67 |
+
an object type and the alignment requirements of `T2` are no stricter
|
| 68 |
+
than those of `T1`) and back to its original type yields the original
|
| 69 |
+
pointer value. — *end note*]
|
| 70 |
|
| 71 |
Converting a function pointer to an object pointer type or vice versa is
|
| 72 |
conditionally-supported. The meaning of such a conversion is
|
| 73 |
*implementation-defined*, except that if an implementation supports
|
| 74 |
conversions in both directions, converting a prvalue of one type to the
|
|
|
|
| 76 |
yield the original pointer value.
|
| 77 |
|
| 78 |
The null pointer value [[basic.compound]] is converted to the null
|
| 79 |
pointer value of the destination type.
|
| 80 |
|
| 81 |
+
[*Note 7*: A null pointer constant of type `std::nullptr_t` cannot be
|
| 82 |
converted to a pointer type, and a null pointer constant of integral
|
| 83 |
type is not necessarily converted to a null pointer
|
| 84 |
value. — *end note*]
|
| 85 |
|
| 86 |
A prvalue of type “pointer to member of `X` of type `T1`” can be
|
| 87 |
explicitly converted to a prvalue of a different type “pointer to member
|
| 88 |
of `Y` of type `T2`” if `T1` and `T2` are both function types or both
|
| 89 |
+
object types.[^18]
|
| 90 |
+
|
| 91 |
+
The null member pointer value [[conv.mem]] is converted to the null
|
| 92 |
+
member pointer value of the destination type. The result of this
|
| 93 |
+
conversion is unspecified, except in the following cases:
|
| 94 |
|
| 95 |
- Converting a prvalue of type “pointer to member function” to a
|
| 96 |
different pointer-to-member-function type and back to its original
|
| 97 |
type yields the original pointer-to-member value.
|
| 98 |
- Converting a prvalue of type “pointer to data member of `X` of type
|