tmp/tmpde24ba2p/{from.md → to.md}
RENAMED
|
@@ -1,22 +1,18 @@
|
|
| 1 |
-
###
|
| 2 |
|
| 3 |
-
In the function descriptions that follow, the members of a
|
| 4 |
-
pack `XTypes` are denoted by `X`ᵢ for i in \[`0`,
|
| 5 |
`sizeof...(`*X*`Types)`) in order, where indexing is zero-based.
|
| 6 |
|
| 7 |
``` cpp
|
| 8 |
template<class... TTypes>
|
| 9 |
-
constexpr tuple<
|
| 10 |
```
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
`reference_wrapper`, then `V`ᵢ in `VTypes` is `U`ᵢ`::type&`, otherwise
|
| 15 |
-
`V`ᵢ is `U`ᵢ.
|
| 16 |
-
|
| 17 |
-
*Returns:* `tuple<VTypes...>(std::forward<TTypes>(t)...)`.
|
| 18 |
|
| 19 |
[*Example 1*:
|
| 20 |
|
| 21 |
``` cpp
|
| 22 |
int i; float j;
|
|
@@ -32,14 +28,14 @@ template<class... TTypes>
|
|
| 32 |
constexpr tuple<TTypes&&...> forward_as_tuple(TTypes&&... t) noexcept;
|
| 33 |
```
|
| 34 |
|
| 35 |
*Effects:* Constructs a tuple of references to the arguments in `t`
|
| 36 |
suitable for forwarding as arguments to a function. Because the result
|
| 37 |
-
may contain references to temporary
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
|
| 42 |
*Returns:* `tuple<TTypes&&...>(std::forward<TTypes>(t)...)`.
|
| 43 |
|
| 44 |
``` cpp
|
| 45 |
template<class... TTypes>
|
|
@@ -70,22 +66,22 @@ template <class... Tuples>
|
|
| 70 |
|
| 71 |
In the following paragraphs, let `Tᵢ` be the iᵗʰ type in `Tuples`, `Uᵢ`
|
| 72 |
be `remove_reference_t<T`ᵢ`>`, and `tpᵢ` be the iᵗʰ parameter in the
|
| 73 |
function parameter pack `tpls`, where all indexing is zero-based.
|
| 74 |
|
| 75 |
-
*
|
| 76 |
where cvᵢ is the (possibly empty) iᵗʰ *cv-qualifier-seq* and `Argsᵢ` is
|
| 77 |
-
the parameter pack representing the element types in `Uᵢ`. Let
|
| 78 |
-
the kᵗʰ type in `Argsᵢ`. For all `A_ik` the following
|
| 79 |
-
|
| 80 |
|
| 81 |
- If `Tᵢ` is deduced as an lvalue reference type, then
|
| 82 |
`is_constructible_v<``A_ik``, `cvᵢ `A_ik``&> == true`, otherwise
|
| 83 |
- `is_constructible_v<``A_ik``, `cvᵢ `A_ik``&&> == true`.
|
| 84 |
|
| 85 |
-
*Remarks:* The types in `CTypes`
|
| 86 |
-
|
| 87 |
where n is equal to `sizeof...(Tuples)`. Let `eᵢ``...` be the iᵗʰ
|
| 88 |
ordered sequence of tuple elements of the resulting `tuple` object
|
| 89 |
corresponding to the type sequence `Argsᵢ`.
|
| 90 |
|
| 91 |
*Returns:* A `tuple` object constructed by initializing the kᵢᵗʰ type
|
|
@@ -96,8 +92,8 @@ get<kᵢ>(std::forward<$T_i$>($tp_i$))
|
|
| 96 |
```
|
| 97 |
|
| 98 |
for each valid kᵢ and each group `eᵢ` in order.
|
| 99 |
|
| 100 |
[*Note 1*: An implementation may support additional types in the
|
| 101 |
-
parameter pack `Tuples` that support the `tuple`-like protocol,
|
| 102 |
-
`pair` and `array`. — *end note*]
|
| 103 |
|
|
|
|
| 1 |
+
### Tuple creation functions <a id="tuple.creation">[[tuple.creation]]</a>
|
| 2 |
|
| 3 |
+
In the function descriptions that follow, the members of a template
|
| 4 |
+
parameter pack `XTypes` are denoted by `X`ᵢ for i in \[`0`,
|
| 5 |
`sizeof...(`*X*`Types)`) in order, where indexing is zero-based.
|
| 6 |
|
| 7 |
``` cpp
|
| 8 |
template<class... TTypes>
|
| 9 |
+
constexpr tuple<unwrap_ref_decay_t<TTypes>...> make_tuple(TTypes&&... t);
|
| 10 |
```
|
| 11 |
|
| 12 |
+
*Returns:*
|
| 13 |
+
`tuple<unwrap_ref_decay_t<TTypes>...>(std::forward<TTypes>(t)...)`.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
[*Example 1*:
|
| 16 |
|
| 17 |
``` cpp
|
| 18 |
int i; float j;
|
|
|
|
| 28 |
constexpr tuple<TTypes&&...> forward_as_tuple(TTypes&&... t) noexcept;
|
| 29 |
```
|
| 30 |
|
| 31 |
*Effects:* Constructs a tuple of references to the arguments in `t`
|
| 32 |
suitable for forwarding as arguments to a function. Because the result
|
| 33 |
+
may contain references to temporary objects, a program shall ensure that
|
| 34 |
+
the return value of this function does not outlive any of its arguments
|
| 35 |
+
(e.g., the program should typically not store the result in a named
|
| 36 |
+
variable).
|
| 37 |
|
| 38 |
*Returns:* `tuple<TTypes&&...>(std::forward<TTypes>(t)...)`.
|
| 39 |
|
| 40 |
``` cpp
|
| 41 |
template<class... TTypes>
|
|
|
|
| 66 |
|
| 67 |
In the following paragraphs, let `Tᵢ` be the iᵗʰ type in `Tuples`, `Uᵢ`
|
| 68 |
be `remove_reference_t<T`ᵢ`>`, and `tpᵢ` be the iᵗʰ parameter in the
|
| 69 |
function parameter pack `tpls`, where all indexing is zero-based.
|
| 70 |
|
| 71 |
+
*Preconditions:* For all i, `Uᵢ` is the type cvᵢ `tuple<``Argsᵢ``...>`,
|
| 72 |
where cvᵢ is the (possibly empty) iᵗʰ *cv-qualifier-seq* and `Argsᵢ` is
|
| 73 |
+
the template parameter pack representing the element types in `Uᵢ`. Let
|
| 74 |
+
`A_ik` be the kᵗʰ type in `Argsᵢ`. For all `A_ik` the following
|
| 75 |
+
requirements are met:
|
| 76 |
|
| 77 |
- If `Tᵢ` is deduced as an lvalue reference type, then
|
| 78 |
`is_constructible_v<``A_ik``, `cvᵢ `A_ik``&> == true`, otherwise
|
| 79 |
- `is_constructible_v<``A_ik``, `cvᵢ `A_ik``&&> == true`.
|
| 80 |
|
| 81 |
+
*Remarks:* The types in `CTypes` are equal to the ordered sequence of
|
| 82 |
+
the extended types `Args₀``..., ``Args₁``..., `…`, ``Args_n-1``...`,
|
| 83 |
where n is equal to `sizeof...(Tuples)`. Let `eᵢ``...` be the iᵗʰ
|
| 84 |
ordered sequence of tuple elements of the resulting `tuple` object
|
| 85 |
corresponding to the type sequence `Argsᵢ`.
|
| 86 |
|
| 87 |
*Returns:* A `tuple` object constructed by initializing the kᵢᵗʰ type
|
|
|
|
| 92 |
```
|
| 93 |
|
| 94 |
for each valid kᵢ and each group `eᵢ` in order.
|
| 95 |
|
| 96 |
[*Note 1*: An implementation may support additional types in the
|
| 97 |
+
template parameter pack `Tuples` that support the `tuple`-like protocol,
|
| 98 |
+
such as `pair` and `array`. — *end note*]
|
| 99 |
|