tmp/tmpq_ojsp05/{from.md → to.md}
RENAMED
|
@@ -26,13 +26,13 @@ void f(X arg) {
|
|
| 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
|
| 32 |
explicitly used; see also [[over.match.copy]]. A default constructor
|
| 33 |
-
|
| 34 |
perform default-initialization or value-initialization [[dcl.init]].
|
| 35 |
|
| 36 |
[*Example 2*:
|
| 37 |
|
| 38 |
``` cpp
|
|
@@ -40,19 +40,19 @@ struct Z {
|
|
| 40 |
explicit Z();
|
| 41 |
explicit Z(int);
|
| 42 |
explicit Z(int, int);
|
| 43 |
};
|
| 44 |
|
| 45 |
-
Z a; // OK
|
| 46 |
-
Z b{}; // OK
|
| 47 |
Z c = {}; // error: copy-list-initialization
|
| 48 |
Z a1 = 1; // error: no implicit conversion
|
| 49 |
-
Z a3 = Z(1); // OK
|
| 50 |
-
Z a2(1); // OK
|
| 51 |
-
Z* p = new Z(1); // OK
|
| 52 |
-
Z a4 = (Z)1; // OK
|
| 53 |
-
Z a5 = static_cast<Z>(1); // OK
|
| 54 |
Z a6 = { 3, 4 }; // error: no implicit conversion
|
| 55 |
```
|
| 56 |
|
| 57 |
— *end example*]
|
| 58 |
|
|
@@ -60,8 +60,8 @@ Z a6 = { 3, 4 }; // error: no implicit conversion
|
|
| 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
|
| 66 |
conversions. — *end note*]
|
| 67 |
|
|
|
|
| 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 |
+
can 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
|
|
|
|
| 40 |
explicit Z();
|
| 41 |
explicit Z(int);
|
| 42 |
explicit Z(int, int);
|
| 43 |
};
|
| 44 |
|
| 45 |
+
Z a; // OK, default-initialization performed
|
| 46 |
+
Z b{}; // OK, direct initialization syntax used
|
| 47 |
Z c = {}; // error: copy-list-initialization
|
| 48 |
Z a1 = 1; // error: no implicit conversion
|
| 49 |
+
Z a3 = Z(1); // OK, direct initialization syntax used
|
| 50 |
+
Z a2(1); // OK, direct initialization syntax used
|
| 51 |
+
Z* p = new Z(1); // OK, direct initialization syntax used
|
| 52 |
+
Z a4 = (Z)1; // OK, explicit cast used
|
| 53 |
+
Z a5 = static_cast<Z>(1); // OK, explicit cast used
|
| 54 |
Z a6 = { 3, 4 }; // error: no implicit conversion
|
| 55 |
```
|
| 56 |
|
| 57 |
— *end example*]
|
| 58 |
|
|
|
|
| 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 can be called for implicit type
|
| 66 |
conversions. — *end note*]
|
| 67 |
|