tmp/tmpegj72hur/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### General <a id="conv.general">[[conv.general]]</a>
|
| 2 |
+
|
| 3 |
+
Standard conversions are implicit conversions with built-in meaning.
|
| 4 |
+
[[conv]] enumerates the full set of such conversions. A *standard
|
| 5 |
+
conversion sequence* is a sequence of standard conversions in the
|
| 6 |
+
following order:
|
| 7 |
+
|
| 8 |
+
- Zero or one conversion from the following set: lvalue-to-rvalue
|
| 9 |
+
conversion, array-to-pointer conversion, and function-to-pointer
|
| 10 |
+
conversion.
|
| 11 |
+
- Zero or one conversion from the following set: integral promotions,
|
| 12 |
+
floating-point promotion, integral conversions, floating-point
|
| 13 |
+
conversions, floating-integral conversions, pointer conversions,
|
| 14 |
+
pointer-to-member conversions, and boolean conversions.
|
| 15 |
+
- Zero or one function pointer conversion.
|
| 16 |
+
- Zero or one qualification conversion.
|
| 17 |
+
|
| 18 |
+
[*Note 1*: A standard conversion sequence can be empty, i.e., it can
|
| 19 |
+
consist of no conversions. — *end note*]
|
| 20 |
+
|
| 21 |
+
A standard conversion sequence will be applied to an expression if
|
| 22 |
+
necessary to convert it to a required destination type.
|
| 23 |
+
|
| 24 |
+
[*Note 2*:
|
| 25 |
+
|
| 26 |
+
Expressions with a given type will be implicitly converted to other
|
| 27 |
+
types in several contexts:
|
| 28 |
+
|
| 29 |
+
- When used as operands of operators. The operator’s requirements for
|
| 30 |
+
its operands dictate the destination type [[expr.compound]].
|
| 31 |
+
- When used in the condition of an `if` statement [[stmt.if]] or
|
| 32 |
+
iteration statement [[stmt.iter]]. The destination type is `bool`.
|
| 33 |
+
- When used in the expression of a `switch` statement [[stmt.switch]].
|
| 34 |
+
The destination type is integral.
|
| 35 |
+
- When used as the source expression for an initialization (which
|
| 36 |
+
includes use as an argument in a function call and use as the
|
| 37 |
+
expression in a `return` statement). The type of the entity being
|
| 38 |
+
initialized is (generally) the destination type. See [[dcl.init]],
|
| 39 |
+
[[dcl.init.ref]].
|
| 40 |
+
|
| 41 |
+
— *end note*]
|
| 42 |
+
|
| 43 |
+
An expression E can be *implicitly converted* to a type `T` if and only
|
| 44 |
+
if the declaration `T t=E;` is well-formed, for some invented temporary
|
| 45 |
+
variable `t` [[dcl.init]].
|
| 46 |
+
|
| 47 |
+
Certain language constructs require that an expression be converted to a
|
| 48 |
+
Boolean value. An expression E appearing in such a context is said to be
|
| 49 |
+
*contextually converted to `bool`* and is well-formed if and only if the
|
| 50 |
+
declaration `bool t(E);` is well-formed, for some invented temporary
|
| 51 |
+
variable `t` [[dcl.init]].
|
| 52 |
+
|
| 53 |
+
Certain language constructs require conversion to a value having one of
|
| 54 |
+
a specified set of types appropriate to the construct. An expression E
|
| 55 |
+
of class type `C` appearing in such a context is said to be
|
| 56 |
+
*contextually implicitly converted* to a specified type `T` and is
|
| 57 |
+
well-formed if and only if E can be implicitly converted to a type `T`
|
| 58 |
+
that is determined as follows: `C` is searched for non-explicit
|
| 59 |
+
conversion functions whose return type is cv `T` or reference to cv `T`
|
| 60 |
+
such that `T` is allowed by the context. There shall be exactly one such
|
| 61 |
+
`T`.
|
| 62 |
+
|
| 63 |
+
The effect of any implicit conversion is the same as performing the
|
| 64 |
+
corresponding declaration and initialization and then using the
|
| 65 |
+
temporary variable as the result of the conversion. The result is an
|
| 66 |
+
lvalue if `T` is an lvalue reference type or an rvalue reference to
|
| 67 |
+
function type [[dcl.ref]], an xvalue if `T` is an rvalue reference to
|
| 68 |
+
object type, and a prvalue otherwise. The expression E is used as a
|
| 69 |
+
glvalue if and only if the initialization uses it as a glvalue.
|
| 70 |
+
|
| 71 |
+
[*Note 3*: For class types, user-defined conversions are considered as
|
| 72 |
+
well; see [[class.conv]]. In general, an implicit conversion sequence
|
| 73 |
+
[[over.best.ics]] consists of a standard conversion sequence followed by
|
| 74 |
+
a user-defined conversion followed by another standard conversion
|
| 75 |
+
sequence. — *end note*]
|
| 76 |
+
|
| 77 |
+
[*Note 4*: There are some contexts where certain conversions are
|
| 78 |
+
suppressed. For example, the lvalue-to-rvalue conversion is not done on
|
| 79 |
+
the operand of the unary `&` operator. Specific exceptions are given in
|
| 80 |
+
the descriptions of those operators and contexts. — *end note*]
|
| 81 |
+
|