From Jason Turner

[tuple.creation]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpg7on997i/{from.md → to.md} +23 -38
tmp/tmpg7on997i/{from.md → to.md} RENAMED
@@ -1,11 +1,7 @@
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
 
@@ -14,11 +10,11 @@ template<class... TTypes>
14
 
15
  [*Example 1*:
16
 
17
  ``` cpp
18
  int i; float j;
19
- make_tuple(1, ref(i), cref(j))
20
  ```
21
 
22
  creates a tuple of type `tuple<int, int&, const float&>`.
23
 
24
  — *end example*]
@@ -58,42 +54,31 @@ tie(i, ignore, s) = make_tuple(42, 3.14, "C++");
58
  ```
59
 
60
  — *end example*]
61
 
62
  ``` cpp
63
- template<class... Tuples>
64
  constexpr tuple<CTypes...> tuple_cat(Tuples&&... tpls);
65
  ```
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 cvis 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
88
- element `e_ik` in `eᵢ``...` with
89
-
90
- ``` cpp
91
- get<kᵢ>(std::forward<$T_i$>($tp_i$))
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
 
 
1
  ### Tuple creation functions <a id="tuple.creation">[[tuple.creation]]</a>
2
 
 
 
 
 
3
  ``` cpp
4
  template<class... TTypes>
5
  constexpr tuple<unwrap_ref_decay_t<TTypes>...> make_tuple(TTypes&&... t);
6
  ```
7
 
 
10
 
11
  [*Example 1*:
12
 
13
  ``` cpp
14
  int i; float j;
15
+ make_tuple(1, ref(i), cref(j));
16
  ```
17
 
18
  creates a tuple of type `tuple<int, int&, const float&>`.
19
 
20
  — *end example*]
 
54
  ```
55
 
56
  — *end example*]
57
 
58
  ``` cpp
59
+ template<tuple-like... Tuples>
60
  constexpr tuple<CTypes...> tuple_cat(Tuples&&... tpls);
61
  ```
62
 
63
+ Let n be `sizeof...(Tuples)`. For every integer 0 i < n:
64
+
65
+ - Let `Tᵢ` be the iᵗʰ type in `Tuples`.
66
+ - Let `Uᵢ` be `remove_cvref_t<``Tᵢ``>`.
67
+ - Let `tpᵢ` be the iᵗʰ element in the function parameter pack `tpls`.
68
+ - Let Sbe `tuple_size_v<``Uᵢ``>`.
69
+ - Let Eᵢᵏ be `tuple_element_t<`k`, ``Uᵢ``>`.
70
+ - Let eᵢᵏ be `get<`k`>(std::forward<``Tᵢ``>(``tpᵢ``))`.
71
+ - Let Elemsᵢ be a pack of the types $E_i^0, \dotsc, E_i^{S_{i-1}}$.
72
+ - Let elemsᵢ be a pack of the expressions
73
+ $e_i^0, \dotsc, e_i^{S_{i-1}}$.
74
+
75
+ The types in `CTypes` are equal to the ordered sequence of the expanded
76
+ packs of types Elems₀`...`, Elems₁`...`, …, Elemsₙ₋₁`...`. Let `celems`
77
+ be the ordered sequence of the expanded packs of expressions
78
+ elems₀`...`, …, elemsₙ₋₁`...`.
79
+
80
+ *Mandates:* `(is_constructible_v<CTypes, decltype(celems)> && ...)` is
81
+ `true`.
82
+
83
+ *Returns:* `tuple<CTypes...>(celems...)`.
 
 
 
 
 
 
 
 
 
 
 
84