tmp/tmpzarrb93w/{from.md → to.md}
RENAMED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
-
### Conversion by constructor <a id="class.conv.ctor">[[class.conv.ctor]]</a>
|
| 2 |
|
| 3 |
-
A constructor
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
constructor*.
|
| 7 |
|
| 8 |
[*Example 1*:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
struct X {
|
|
@@ -26,15 +25,15 @@ void f(X arg) {
|
|
| 26 |
— *end example*]
|
| 27 |
|
| 28 |
[*Note 1*:
|
| 29 |
|
| 30 |
An explicit constructor constructs objects just like non-explicit
|
| 31 |
-
constructors, but does so only where the direct-initialization syntax
|
| 32 |
-
[[dcl.init]]
|
| 33 |
explicitly used; see also [[over.match.copy]]. A default constructor
|
| 34 |
may be an explicit constructor; such a constructor will be used to
|
| 35 |
-
perform default-initialization or value-initialization
|
| 36 |
|
| 37 |
[*Example 2*:
|
| 38 |
|
| 39 |
``` cpp
|
| 40 |
struct Z {
|
|
@@ -57,11 +56,11 @@ Z a6 = { 3, 4 }; // error: no implicit conversion
|
|
| 57 |
|
| 58 |
— *end example*]
|
| 59 |
|
| 60 |
— *end note*]
|
| 61 |
|
| 62 |
-
A non-explicit copy/move constructor
|
| 63 |
constructor.
|
| 64 |
|
| 65 |
[*Note 2*: An implicitly-declared copy/move constructor is not an
|
| 66 |
explicit constructor; it may be called for implicit type
|
| 67 |
conversions. — *end note*]
|
|
|
|
| 1 |
+
#### Conversion by constructor <a id="class.conv.ctor">[[class.conv.ctor]]</a>
|
| 2 |
|
| 3 |
+
A constructor that is not explicit [[dcl.fct.spec]] specifies a
|
| 4 |
+
conversion from the types of its parameters (if any) to the type of its
|
| 5 |
+
class. Such a constructor is called a *converting constructor*.
|
|
|
|
| 6 |
|
| 7 |
[*Example 1*:
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
struct X {
|
|
|
|
| 25 |
— *end example*]
|
| 26 |
|
| 27 |
[*Note 1*:
|
| 28 |
|
| 29 |
An explicit constructor constructs objects just like non-explicit
|
| 30 |
+
constructors, but does so only where the direct-initialization syntax
|
| 31 |
+
[[dcl.init]] or where casts ([[expr.static.cast]], [[expr.cast]]) are
|
| 32 |
explicitly used; see also [[over.match.copy]]. A default constructor
|
| 33 |
may be an explicit constructor; such a constructor will be used to
|
| 34 |
+
perform default-initialization or value-initialization [[dcl.init]].
|
| 35 |
|
| 36 |
[*Example 2*:
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
struct Z {
|
|
|
|
| 56 |
|
| 57 |
— *end example*]
|
| 58 |
|
| 59 |
— *end note*]
|
| 60 |
|
| 61 |
+
A non-explicit copy/move constructor [[class.copy.ctor]] is a converting
|
| 62 |
constructor.
|
| 63 |
|
| 64 |
[*Note 2*: An implicitly-declared copy/move constructor is not an
|
| 65 |
explicit constructor; it may be called for implicit type
|
| 66 |
conversions. — *end note*]
|