tmp/tmpjd6e8b79/{from.md → to.md}
RENAMED
|
@@ -1,73 +1,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
|
| 5 |
-
[[equalitycomparable]]– [[destructible]]. In these tables, `T`
|
| 6 |
-
object or reference type to be supplied by a C++program
|
| 7 |
-
template; `a`, `b`, and `c` are values of type (possibly
|
| 8 |
-
`s` and `t` are modifiable lvalues of type `T`; `u`
|
| 9 |
-
identifier; `rv` is an rvalue of type `T`; and `v` is an
|
| 10 |
-
(possibly `const`) `T` or an rvalue of type `const T`.
|
| 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: `EqualityComparable` requirements** <a id="equalitycomparable">[equalitycomparable]</a>
|
| 18 |
|
| 19 |
-
|
|
| 20 |
-
| --------
|
| 21 |
| `a == b` | convertible to `bool` | `==` 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`. |
|
| 22 |
|
| 23 |
**Table: `LessThanComparable` requirements** <a id="lessthancomparable">[lessthancomparable]</a>
|
| 24 |
|
| 25 |
-
|
|
| 26 |
-
| ------- | --------------------- | --------------------------------------------------------- |
|
| 27 |
| `a < b` | convertible to `bool` | `<` is a strict weak ordering relation~([[alg.sorting]]) |
|
| 28 |
|
| 29 |
**Table: `DefaultConstructible` requirements** <a id="defaultconstructible">[defaultconstructible]</a>
|
| 30 |
|
| 31 |
-
|
|
| 32 |
-
| -------- | --------------------------------------------------- |
|
| 33 |
| `T t;` | object `t` is default-initialized |
|
| 34 |
-
| `T u{};`
|
| 35 |
-
| `T()`
|
| 36 |
-
| `T{}` | |
|
| 37 |
|
| 38 |
-
**
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
| `T u = rv;` | `u` is equivalent to the value of `rv` before the construction |
|
| 43 |
-
| `T(rv)` | `T(rv)` is equivalent to the value of `rv` before the construction |
|
| 44 |
-
| *[spans 2 columns]* `rv`'s state is unspecified \enternote `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. \exitnote |
|
| 45 |
|
| 46 |
**Table: `CopyConstructible` requirements (in addition to `MoveConstructible`)** <a id="copyconstructible">[copyconstructible]</a>
|
| 47 |
|
| 48 |
-
|
|
| 49 |
| ---------- | --------------------------------------------------------- |
|
| 50 |
| `T u = v;` | the value of `v` is unchanged and is equivalent to ` u` |
|
| 51 |
| `T(v)` | the value of `v` is unchanged and is equivalent to `T(v)` |
|
| 52 |
|
| 53 |
-
**
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
| `t = rv` | `T&` | `t` | `t` is equivalent to the value of `rv` before the assignment |
|
| 58 |
-
| *[spans 4 columns]* `rv`'s state is unspecified. \enternote\ `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. \exitnote |
|
| 59 |
|
| 60 |
**Table: `CopyAssignable` requirements (in addition to `MoveAssignable`)** <a id="copyassignable">[copyassignable]</a>
|
| 61 |
|
| 62 |
-
|
|
| 63 |
-
| ------- | ---- | --- | ------------------------------------------------------- |
|
| 64 |
| `t = v` | `T&` | `t` | `t` is equivalent to `v`, the value of `v` is unchanged |
|
| 65 |
|
| 66 |
|
| 67 |
**Table: `Destructible` requirements** <a id="destructible">[destructible]</a>
|
| 68 |
|
| 69 |
-
|
|
| 70 |
-
| -------- | --------------------------------------------------------------------- |
|
| 71 |
| `u.~T()` | All resources owned by `u` are reclaimed, no exception is propagated. |
|
| 72 |
|
| 73 |
|
|
|
|
| 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:equalitycomparable]]– [[tab:destructible]]. In these tables, `T`
|
| 6 |
+
is an object or reference type to be supplied by a C++program
|
| 7 |
+
instantiating a template; `a`, `b`, and `c` are values of type (possibly
|
| 8 |
+
`const`) `T`; `s` and `t` are modifiable lvalues of type `T`; `u`
|
| 9 |
+
denotes an identifier; `rv` is an rvalue of type `T`; and `v` is an
|
| 10 |
+
lvalue of type (possibly `const`) `T` or an rvalue of type `const T`.
|
| 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: `EqualityComparable` requirements** <a id="equalitycomparable">[equalitycomparable]</a>
|
| 18 |
|
| 19 |
+
| Expression | Return type |
|
| 20 |
+
| ---------- | ----------- |
|
| 21 |
| `a == b` | convertible to `bool` | `==` 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`. |
|
| 22 |
|
| 23 |
**Table: `LessThanComparable` requirements** <a id="lessthancomparable">[lessthancomparable]</a>
|
| 24 |
|
| 25 |
+
| Expression | Return type | Requirement |
|
| 26 |
+
| ---------- | --------------------- | --------------------------------------------------------- |
|
| 27 |
| `a < b` | convertible to `bool` | `<` is a strict weak ordering relation~([[alg.sorting]]) |
|
| 28 |
|
| 29 |
**Table: `DefaultConstructible` requirements** <a id="defaultconstructible">[defaultconstructible]</a>
|
| 30 |
|
| 31 |
+
| Expression | Post-condition |
|
| 32 |
+
| -------------- | ------------------------------------------------------------------- |
|
| 33 |
| `T t;` | object `t` is default-initialized |
|
| 34 |
+
| `T u{};` | object `u` is value-initialized or aggregate-initialized |
|
| 35 |
+
| `T()`<br>`T{}` | an object of type `T` is value-initialized or aggregate-initialized |
|
|
|
|
| 36 |
|
| 37 |
+
[*Note 1*: `rv` must still meet the requirements of the library
|
| 38 |
+
component that is using it. The operations listed in those requirements
|
| 39 |
+
must work as specified whether `rv` has been moved from or
|
| 40 |
+
not. — *end note*]
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
**Table: `CopyConstructible` requirements (in addition to `MoveConstructible`)** <a id="copyconstructible">[copyconstructible]</a>
|
| 43 |
|
| 44 |
+
| Expression | Post-condition |
|
| 45 |
| ---------- | --------------------------------------------------------- |
|
| 46 |
| `T u = v;` | the value of `v` is unchanged and is equivalent to ` u` |
|
| 47 |
| `T(v)` | the value of `v` is unchanged and is equivalent to `T(v)` |
|
| 48 |
|
| 49 |
+
[*Note 2*: `rv` must still meet the requirements of the library
|
| 50 |
+
component that is using it, whether or not `t` and `rv` refer to the
|
| 51 |
+
same object. The operations listed in those requirements must work as
|
| 52 |
+
specified whether `rv` has been moved from or not. — *end note*]
|
|
|
|
|
|
|
| 53 |
|
| 54 |
**Table: `CopyAssignable` requirements (in addition to `MoveAssignable`)** <a id="copyassignable">[copyassignable]</a>
|
| 55 |
|
| 56 |
+
| Expression | Return type | Return value | Post-condition |
|
| 57 |
+
| ---------- | ----------- | ------------ | ------------------------------------------------------- |
|
| 58 |
| `t = v` | `T&` | `t` | `t` is equivalent to `v`, the value of `v` is unchanged |
|
| 59 |
|
| 60 |
|
| 61 |
**Table: `Destructible` requirements** <a id="destructible">[destructible]</a>
|
| 62 |
|
| 63 |
+
| Expression | Post-condition |
|
| 64 |
+
| ---------- | --------------------------------------------------------------------- |
|
| 65 |
| `u.~T()` | All resources owned by `u` are reclaimed, no exception is propagated. |
|
| 66 |
|
| 67 |
|