tmp/tmp_ndcli4p/{from.md → to.md}
RENAMED
|
@@ -1,33 +1,38 @@
|
|
| 1 |
#### Template argument requirements <a id="utility.arg.requirements">[[utility.arg.requirements]]</a>
|
| 2 |
|
| 3 |
The template definitions in the C++ standard library refer to various
|
| 4 |
named requirements whose details are set out in Tables
|
| 5 |
[[tab:cpp17.equalitycomparable]]– [[tab:cpp17.destructible]]. In these
|
| 6 |
-
tables,
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
In general, a default constructor is not required. Certain container
|
| 13 |
class member function signatures specify `T()` as a default argument.
|
| 14 |
`T()` shall be a well-defined expression [[dcl.init]] if one of those
|
| 15 |
signatures is called using the default argument [[dcl.fct.default]].
|
| 16 |
|
| 17 |
**Table: Cpp17EqualityComparable requirements** <a id="cpp17.equalitycomparable">[cpp17.equalitycomparable]</a>
|
| 18 |
|
| 19 |
| Expression | Return type |
|
| 20 |
| ---------- | ----------- |
|
| 21 |
-
| `a == b` |
|
| 22 |
|
| 23 |
|
| 24 |
**Table: Cpp17LessThanComparable requirements** <a id="cpp17.lessthancomparable">[cpp17.lessthancomparable]</a>
|
| 25 |
|
| 26 |
| Expression | Return type | Requirement |
|
| 27 |
-
| ---------- | --------------------- | ------------------------------------------------------ |
|
| 28 |
-
| `a < b` |
|
| 29 |
|
| 30 |
|
| 31 |
**Table: Cpp17DefaultConstructible requirements** <a id="cpp17.defaultconstructible">[cpp17.defaultconstructible]</a>
|
| 32 |
|
| 33 |
| Expression | Post-condition |
|
|
@@ -35,33 +40,45 @@ signatures is called using the default argument [[dcl.fct.default]].
|
|
| 35 |
| `T t;` | object `t` is default-initialized |
|
| 36 |
| `T u{};` | object `u` is value-initialized or aggregate-initialized |
|
| 37 |
| `T()`<br>`T{}` | an object of type `T` is value-initialized or aggregate-initialized |
|
| 38 |
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
**Table: Cpp17CopyConstructible requirements (in addition to Cpp17MoveConstructible)** <a id="cpp17.copyconstructible">[cpp17.copyconstructible]</a>
|
| 46 |
|
| 47 |
| Expression | Post-condition |
|
| 48 |
| ---------- | --------------------------------------------------------- |
|
| 49 |
| `T u = v;` | the value of `v` is unchanged and is equivalent to ` u` |
|
| 50 |
| `T(v)` | the value of `v` is unchanged and is equivalent to `T(v)` |
|
| 51 |
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
**Table: Cpp17CopyAssignable requirements (in addition to Cpp17MoveAssignable)** <a id="cpp17.copyassignable">[cpp17.copyassignable]</a>
|
| 59 |
|
| 60 |
| Expression | Return type | Return value | Post-condition |
|
| 61 |
| ---------- | ----------- | ------------ | ------------------------------------------------------- |
|
| 62 |
| `t = v` | `T&` | `t` | `t` is equivalent to `v`, the value of `v` is unchanged |
|
| 63 |
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
|
|
|
| 1 |
#### Template argument requirements <a id="utility.arg.requirements">[[utility.arg.requirements]]</a>
|
| 2 |
|
| 3 |
The template definitions in the C++ standard library refer to various
|
| 4 |
named requirements whose details are set out in Tables
|
| 5 |
[[tab:cpp17.equalitycomparable]]– [[tab:cpp17.destructible]]. In these
|
| 6 |
+
tables,
|
| 7 |
+
|
| 8 |
+
- `T` denotes an object or reference type to be supplied by a C++
|
| 9 |
+
program instantiating a template,
|
| 10 |
+
- `a`, `b`, and `c` denote values of type (possibly const) `T`,
|
| 11 |
+
- `s` and `t` denote modifiable lvalues of type `T`,
|
| 12 |
+
- `u` denotes an identifier,
|
| 13 |
+
- `rv` denotes an rvalue of type `T`, and
|
| 14 |
+
- `v` denotes an lvalue of type (possibly const) `T` or an rvalue of
|
| 15 |
+
type `const T`.
|
| 16 |
|
| 17 |
In general, a default constructor is not required. Certain container
|
| 18 |
class member function signatures specify `T()` as a default argument.
|
| 19 |
`T()` shall be a well-defined expression [[dcl.init]] if one of those
|
| 20 |
signatures is called using the default argument [[dcl.fct.default]].
|
| 21 |
|
| 22 |
**Table: Cpp17EqualityComparable requirements** <a id="cpp17.equalitycomparable">[cpp17.equalitycomparable]</a>
|
| 23 |
|
| 24 |
| Expression | Return type |
|
| 25 |
| ---------- | ----------- |
|
| 26 |
+
| `a == b` | `decltype(a == b)` models `boolean-testable` | `==` is an equivalence relation, that is, it has the following properties: For all `a`, `a == a`.; If `a == b`, then `b == a`.; If `a == b` and `b == c`, then `a == c`. |
|
| 27 |
|
| 28 |
|
| 29 |
**Table: Cpp17LessThanComparable requirements** <a id="cpp17.lessthancomparable">[cpp17.lessthancomparable]</a>
|
| 30 |
|
| 31 |
| Expression | Return type | Requirement |
|
| 32 |
+
| ---------- | ------------------------------------------- | ------------------------------------------------------ |
|
| 33 |
+
| `a < b` | `decltype(a < b)` models `boolean-testable` | `<` is a strict weak ordering relation [[alg.sorting]] |
|
| 34 |
|
| 35 |
|
| 36 |
**Table: Cpp17DefaultConstructible requirements** <a id="cpp17.defaultconstructible">[cpp17.defaultconstructible]</a>
|
| 37 |
|
| 38 |
| Expression | Post-condition |
|
|
|
|
| 40 |
| `T t;` | object `t` is default-initialized |
|
| 41 |
| `T u{};` | object `u` is value-initialized or aggregate-initialized |
|
| 42 |
| `T()`<br>`T{}` | an object of type `T` is value-initialized or aggregate-initialized |
|
| 43 |
|
| 44 |
|
| 45 |
+
**Table: Cpp17MoveConstructible requirements** <a id="cpp17.moveconstructible">[cpp17.moveconstructible]</a>
|
| 46 |
+
|
| 47 |
+
| Expression | Post-condition |
|
| 48 |
+
| ----------- | ------------------------------------------------------------------ |
|
| 49 |
+
| `T u = rv;` | `u` is equivalent to the value of `rv` before the construction |
|
| 50 |
+
| `T(rv)` | `T(rv)` is equivalent to the value of `rv` before the construction |
|
| 51 |
+
| *[spans 2 columns]* `rv`'s state is unspecified *`rv` must still meet the requirements of the library component that is using it. The operations listed in those requirements must work as specified whether `rv` has been moved from or not.* |
|
| 52 |
+
|
| 53 |
|
| 54 |
**Table: Cpp17CopyConstructible requirements (in addition to Cpp17MoveConstructible)** <a id="cpp17.copyconstructible">[cpp17.copyconstructible]</a>
|
| 55 |
|
| 56 |
| Expression | Post-condition |
|
| 57 |
| ---------- | --------------------------------------------------------- |
|
| 58 |
| `T u = v;` | the value of `v` is unchanged and is equivalent to ` u` |
|
| 59 |
| `T(v)` | the value of `v` is unchanged and is equivalent to `T(v)` |
|
| 60 |
|
| 61 |
|
| 62 |
+
**Table: Cpp17MoveAssignable requirements** <a id="cpp17.moveassignable">[cpp17.moveassignable]</a>
|
| 63 |
+
|
| 64 |
+
| Expression | Return type | Return value | Post-condition |
|
| 65 |
+
| ---------- | ----------- | ------------ | ------------------------------------------------------------------------------------------------------------- |
|
| 66 |
+
| `t = rv` | `T&` | `t` | If `t` and `rv` do not refer to the same object, `t` is equivalent to the value of `rv` before the assignment |
|
| 67 |
+
| *[spans 4 columns]* `rv`'s state is unspecified. *`rv` must still meet the requirements of the library component that is using it, whether or not `t` and `rv` refer to the same object. The operations listed in those requirements must work as specified whether `rv` has been moved from or not.* |
|
| 68 |
+
|
| 69 |
|
| 70 |
**Table: Cpp17CopyAssignable requirements (in addition to Cpp17MoveAssignable)** <a id="cpp17.copyassignable">[cpp17.copyassignable]</a>
|
| 71 |
|
| 72 |
| Expression | Return type | Return value | Post-condition |
|
| 73 |
| ---------- | ----------- | ------------ | ------------------------------------------------------- |
|
| 74 |
| `t = v` | `T&` | `t` | `t` is equivalent to `v`, the value of `v` is unchanged |
|
| 75 |
|
| 76 |
|
| 77 |
+
**Table: Cpp17Destructible requirements** <a id="cpp17.destructible">[cpp17.destructible]</a>
|
| 78 |
+
|
| 79 |
+
| Expression | Post-condition |
|
| 80 |
+
| ---------- | --------------------------------------------------------------------- |
|
| 81 |
+
| `u.~T()` | All resources owned by `u` are reclaimed, no exception is propagated. |
|
| 82 |
+
| *[spans 2 columns]* *Array types and non-object types are not Cpp17Destructible.* |
|
| 83 |
+
|
| 84 |
|