From Jason Turner

[tuple.cnstr]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmph699_bnn/{from.md → to.md} +114 -60
tmp/tmph699_bnn/{from.md → to.md} RENAMED
@@ -8,17 +8,19 @@ indexing is zero-based.
8
  For each `tuple` constructor, an exception is thrown only if the
9
  construction of one of the types in `Types` throws an exception.
10
 
11
  The defaulted move and copy constructor, respectively, of `tuple` is a
12
  constexpr function if and only if all required element-wise
13
- initializations for move and copy, respectively, would satisfy the
14
- requirements for a constexpr function. The defaulted move and copy
15
  constructor of `tuple<>` are constexpr functions.
16
 
17
  If `is_trivially_destructible_v<Tᵢ>` is `true` for all `Tᵢ`, then the
18
  destructor of `tuple` is trivial.
19
 
 
 
20
  ``` cpp
21
  constexpr explicit(see below) tuple();
22
  ```
23
 
24
  *Constraints:* `is_default_constructible_v<``Tᵢ``>` is `true` for all i.
@@ -50,23 +52,43 @@ parameter.
50
 
51
  ``` cpp
52
  template<class... UTypes> constexpr explicit(see below) tuple(UTypes&&... u);
53
  ```
54
 
55
- *Constraints:* `sizeof...(Types)` equals `sizeof...(UTypes)` and
56
- `sizeof...(Types)` ≥ 1 and `is_constructible_v<``Tᵢ``, ``Uᵢ``>` is
57
- `true` for all i.
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  *Effects:* Initializes the elements in the tuple with the corresponding
60
  value in `std::forward<UTypes>(u)`.
61
 
62
  *Remarks:* The expression inside `explicit` is equivalent to:
63
 
64
  ``` cpp
65
  !conjunction_v<is_convertible<UTypes, Types>...>
66
  ```
67
 
 
 
 
 
 
 
 
 
68
  ``` cpp
69
  tuple(const tuple& u) = default;
70
  ```
71
 
72
  *Mandates:* `is_copy_constructible_v<``Tᵢ``>` is `true` for all i.
@@ -82,91 +104,108 @@ tuple(tuple&& u) = default;
82
 
83
  *Effects:* For all i, initializes the iᵗʰ element of `*this` with
84
  `std::forward<``Tᵢ``>(get<`i`>(u))`.
85
 
86
  ``` cpp
 
87
  template<class... UTypes> constexpr explicit(see below) tuple(const tuple<UTypes...>& u);
88
- ```
89
-
90
- *Constraints:*
91
-
92
- - `sizeof...(Types)` equals `sizeof...(UTypes)` and
93
- - `is_constructible_v<``Tᵢ``, const ``Uᵢ``&>` is `true` for all i, and
94
- - either `sizeof...(Types)` is not 1, or (when `Types...` expands to `T`
95
- and `UTypes...` expands to `U`)
96
- `is_convertible_v<const tuple<U>&, T>`,
97
- `is_constructible_v<T, const tuple<U>&>`, and `is_same_v<T, U>` are
98
- all `false`.
99
-
100
- *Effects:* Initializes each element of `*this` with the corresponding
101
- element of `u`.
102
-
103
- *Remarks:* The expression inside `explicit` is equivalent to:
104
-
105
- ``` cpp
106
- !conjunction_v<is_convertible<const UTypes&, Types>...>
107
- ```
108
-
109
- ``` cpp
110
  template<class... UTypes> constexpr explicit(see below) tuple(tuple<UTypes...>&& u);
 
111
  ```
112
 
 
 
 
113
  *Constraints:*
114
 
115
  - `sizeof...(Types)` equals `sizeof...(UTypes)`, and
116
- - `is_constructible_v<``Tᵢ``, ``Uᵢ``>` is `true` for all i, and
 
117
  - either `sizeof...(Types)` is not 1, or (when `Types...` expands to `T`
118
- and `UTypes...` expands to `U`) `is_convertible_v<tuple<U>, T>`,
119
- `is_constructible_v<T, tuple<U>>`, and `is_same_v<T, U>` are all
120
  `false`.
121
 
122
- *Effects:* For all i, initializes the iᵗʰ element of `*this` with
123
- `std::forward<``Uᵢ``>(get<`i`>(u))`.
124
 
125
  *Remarks:* The expression inside `explicit` is equivalent to:
126
 
127
  ``` cpp
128
- !conjunction_v<is_convertible<UTypes, Types>...>
129
  ```
130
 
 
 
 
 
 
 
 
 
131
  ``` cpp
 
132
  template<class U1, class U2> constexpr explicit(see below) tuple(const pair<U1, U2>& u);
133
- ```
134
-
135
- *Constraints:*
136
-
137
- - `sizeof...(Types)` is 2,
138
- - `is_constructible_v<``T₀``, const U1&>` is `true`, and
139
- - `is_constructible_v<``T₁``, const U2&>` is `true`.
140
-
141
- *Effects:* Initializes the first element with `u.first` and the second
142
- element with `u.second`.
143
-
144
- The expression inside `explicit` is equivalent to:
145
-
146
- ``` cpp
147
- !is_convertible_v<const U1&, $T_0$> || !is_convertible_v<const U2&, $T_1$>
148
- ```
149
-
150
- ``` cpp
151
  template<class U1, class U2> constexpr explicit(see below) tuple(pair<U1, U2>&& u);
 
152
  ```
153
 
 
 
154
  *Constraints:*
155
 
156
  - `sizeof...(Types)` is 2,
157
- - `is_constructible_v<``T₀``, U1>` is `true`, and
158
- - `is_constructible_v<``T₁``, U2>` is `true`.
 
 
159
 
160
- *Effects:* Initializes the first element with
161
- `std::forward<U1>(u.first)` and the second element with
162
- `std::forward<U2>(u.second)`.
163
 
164
- The expression inside `explicit` is equivalent to:
165
 
166
  ``` cpp
167
- !is_convertible_v<U1, $T_0$> || !is_convertible_v<U2, $T_1$>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  ```
169
 
170
  ``` cpp
171
  template<class Alloc>
172
  constexpr explicit(see below)
@@ -179,26 +218,41 @@ template<class Alloc, class... UTypes>
179
  tuple(allocator_arg_t, const Alloc& a, UTypes&&...);
180
  template<class Alloc>
181
  constexpr tuple(allocator_arg_t, const Alloc& a, const tuple&);
182
  template<class Alloc>
183
  constexpr tuple(allocator_arg_t, const Alloc& a, tuple&&);
 
 
 
184
  template<class Alloc, class... UTypes>
185
  constexpr explicit(see below)
186
  tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&);
187
  template<class Alloc, class... UTypes>
188
  constexpr explicit(see below)
189
  tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
 
 
 
 
 
 
190
  template<class Alloc, class U1, class U2>
191
  constexpr explicit(see below)
192
  tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
193
  template<class Alloc, class U1, class U2>
194
  constexpr explicit(see below)
195
  tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
 
 
 
 
 
 
196
  ```
197
 
198
- *Preconditions:* `Alloc` meets the *Cpp17Allocator* requirements
199
- ([[cpp17.allocator]]).
200
 
201
  *Effects:* Equivalent to the preceding constructors except that each
202
  element is constructed with uses-allocator
203
  construction [[allocator.uses.construction]].
204
 
 
8
  For each `tuple` constructor, an exception is thrown only if the
9
  construction of one of the types in `Types` throws an exception.
10
 
11
  The defaulted move and copy constructor, respectively, of `tuple` is a
12
  constexpr function if and only if all required element-wise
13
+ initializations for move and copy, respectively, would be
14
+ constexpr-suitable [[dcl.constexpr]]. The defaulted move and copy
15
  constructor of `tuple<>` are constexpr functions.
16
 
17
  If `is_trivially_destructible_v<Tᵢ>` is `true` for all `Tᵢ`, then the
18
  destructor of `tuple` is trivial.
19
 
20
+ The default constructor of `tuple<>` is trivial.
21
+
22
  ``` cpp
23
  constexpr explicit(see below) tuple();
24
  ```
25
 
26
  *Constraints:* `is_default_constructible_v<``Tᵢ``>` is `true` for all i.
 
52
 
53
  ``` cpp
54
  template<class... UTypes> constexpr explicit(see below) tuple(UTypes&&... u);
55
  ```
56
 
57
+ Let *disambiguating-constraint* be:
58
+
59
+ - `negation<is_same<remove_cvref_t<``U₀``>, tuple>>` if
60
+ `sizeof...(Types)` is 1;
61
+ - otherwise,
62
+ `bool_constant<!is_same_v<remove_cvref_t<``U₀``>, allocator_arg_t> || is_- same_v<remove_cvref_t<``T₀``>, allocator_arg_t>>`
63
+ if `sizeof...(Types)` is 2 or 3;
64
+ - otherwise, `true_type`.
65
+
66
+ *Constraints:*
67
+
68
+ - `sizeof...(Types)` equals `sizeof...(UTypes)`,
69
+ - `sizeof...(Types)` ≥ 1, and
70
+ - `conjunction_v<`*`disambiguating-constraint`*`, is_constructible<Types, UTypes>...>`
71
+ is `true`.
72
 
73
  *Effects:* Initializes the elements in the tuple with the corresponding
74
  value in `std::forward<UTypes>(u)`.
75
 
76
  *Remarks:* The expression inside `explicit` is equivalent to:
77
 
78
  ``` cpp
79
  !conjunction_v<is_convertible<UTypes, Types>...>
80
  ```
81
 
82
+ This constructor is defined as deleted if
83
+
84
+ ``` cpp
85
+ (reference_constructs_from_temporary_v<Types, UTypes&&> || ...)
86
+ ```
87
+
88
+ is `true`.
89
+
90
  ``` cpp
91
  tuple(const tuple& u) = default;
92
  ```
93
 
94
  *Mandates:* `is_copy_constructible_v<``Tᵢ``>` is `true` for all i.
 
104
 
105
  *Effects:* For all i, initializes the iᵗʰ element of `*this` with
106
  `std::forward<``Tᵢ``>(get<`i`>(u))`.
107
 
108
  ``` cpp
109
+ template<class... UTypes> constexpr explicit(see below) tuple(tuple<UTypes...>& u);
110
  template<class... UTypes> constexpr explicit(see below) tuple(const tuple<UTypes...>& u);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  template<class... UTypes> constexpr explicit(see below) tuple(tuple<UTypes...>&& u);
112
+ template<class... UTypes> constexpr explicit(see below) tuple(const tuple<UTypes...>&& u);
113
  ```
114
 
115
+ Let `I` be the pack `0, 1, ..., (sizeof...(Types) - 1)`. Let
116
+ *`FWD`*`(u)` be `static_cast<decltype(u)>(u)`.
117
+
118
  *Constraints:*
119
 
120
  - `sizeof...(Types)` equals `sizeof...(UTypes)`, and
121
+ - `(is_constructible_v<Types, decltype(get<I>(`*`FWD`*`(u)))> && ...)`
122
+ is `true`, and
123
  - either `sizeof...(Types)` is not 1, or (when `Types...` expands to `T`
124
+ and `UTypes...` expands to `U`) `is_convertible_v<decltype(u), T>`,
125
+ `is_constructible_v<T, decltype(u)>`, and `is_same_v<T, U>` are all
126
  `false`.
127
 
128
+ *Effects:* For all i, initializes the $i^\textrm{th}$ element of `*this`
129
+ with `get<`i`>(`*`FWD`*`(u))`.
130
 
131
  *Remarks:* The expression inside `explicit` is equivalent to:
132
 
133
  ``` cpp
134
+ !(is_convertible_v<decltype(get<I>(FWD(u))), Types> && ...)
135
  ```
136
 
137
+ The constructor is defined as deleted if
138
+
139
+ ``` cpp
140
+ (reference_constructs_from_temporary_v<Types, decltype(get<I>(FWD(u)))> || ...)
141
+ ```
142
+
143
+ is `true`.
144
+
145
  ``` cpp
146
+ template<class U1, class U2> constexpr explicit(see below) tuple(pair<U1, U2>& u);
147
  template<class U1, class U2> constexpr explicit(see below) tuple(const pair<U1, U2>& u);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  template<class U1, class U2> constexpr explicit(see below) tuple(pair<U1, U2>&& u);
149
+ template<class U1, class U2> constexpr explicit(see below) tuple(const pair<U1, U2>&& u);
150
  ```
151
 
152
+ Let *`FWD`*`(u)` be `static_cast<decltype(u)>(u)`.
153
+
154
  *Constraints:*
155
 
156
  - `sizeof...(Types)` is 2,
157
+ - `is_constructible_v<``T₀``, decltype(get<0>(`*`FWD`*`(u)))>` is
158
+ `true`, and
159
+ - `is_constructible_v<``T₁``, decltype(get<1>(`*`FWD`*`(u)))>` is
160
+ `true`.
161
 
162
+ *Effects:* Initializes the first element with `get<0>(`*`FWD`*`(u))` and
163
+ the second element with `get<1>(`*`FWD`*`(u))`.
 
164
 
165
+ *Remarks:* The expression inside `explicit` is equivalent to:
166
 
167
  ``` cpp
168
+ !is_convertible_v<decltype(get<0>(FWD(u))), $T_0$> ||
169
+ !is_convertible_v<decltype(get<1>(FWD(u))), $T_1$>
170
+ ```
171
+
172
+ The constructor is defined as deleted if
173
+
174
+ ``` cpp
175
+ reference_constructs_from_temporary_v<$T_0$, decltype(get<0>(FWD(u)))> ||
176
+ reference_constructs_from_temporary_v<$T_1$, decltype(get<1>(FWD(u)))>
177
+ ```
178
+
179
+ is `true`.
180
+
181
+ ``` cpp
182
+ template<tuple-like UTuple>
183
+ constexpr explicit(see below) tuple(UTuple&& u);
184
+ ```
185
+
186
+ Let `I` be the pack `0, 1, …, (sizeof...(Types) - 1)`.
187
+
188
+ *Constraints:*
189
+
190
+ - `different-from<UTuple, tuple>` [[range.utility.helpers]] is `true`,
191
+ - `remove_cvref_t<UTuple>` is not a specialization of
192
+ `ranges::subrange`,
193
+ - `sizeof...(Types)` equals `tuple_size_v<remove_cvref_t<UTuple>>`,
194
+ - `(is_constructible_v<Types, decltype(get<I>(std::forward<UTuple>(u)))> && ...)`
195
+ is `true`, and
196
+ - either `sizeof...(Types)` is not `1`, or (when `Types...` expands to
197
+ `T`) `is_convertible_v<UTuple, T>` and `is_constructible_v<T, UTuple>`
198
+ are both `false`.
199
+
200
+ *Effects:* For all i, initializes the iᵗʰ element of `*this` with
201
+ `get<`i`>(std::forward<UTuple>(u))`.
202
+
203
+ *Remarks:* The expression inside `explicit` is equivalent to:
204
+
205
+ ``` cpp
206
+ !(is_convertible_v<decltype(get<I>(std::forward<UTuple>(u))), Types> && ...)
207
  ```
208
 
209
  ``` cpp
210
  template<class Alloc>
211
  constexpr explicit(see below)
 
218
  tuple(allocator_arg_t, const Alloc& a, UTypes&&...);
219
  template<class Alloc>
220
  constexpr tuple(allocator_arg_t, const Alloc& a, const tuple&);
221
  template<class Alloc>
222
  constexpr tuple(allocator_arg_t, const Alloc& a, tuple&&);
223
+ template<class Alloc, class... UTypes>
224
+ constexpr explicit(see below)
225
+ tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&);
226
  template<class Alloc, class... UTypes>
227
  constexpr explicit(see below)
228
  tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&);
229
  template<class Alloc, class... UTypes>
230
  constexpr explicit(see below)
231
  tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
232
+ template<class Alloc, class... UTypes>
233
+ constexpr explicit(see below)
234
+ tuple(allocator_arg_t, const Alloc& a, const tuple<UTypes...>&&);
235
+ template<class Alloc, class U1, class U2>
236
+ constexpr explicit(see below)
237
+ tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&);
238
  template<class Alloc, class U1, class U2>
239
  constexpr explicit(see below)
240
  tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
241
  template<class Alloc, class U1, class U2>
242
  constexpr explicit(see below)
243
  tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
244
+ template<class Alloc, class U1, class U2>
245
+ constexpr explicit(see below)
246
+ tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&&);
247
+ template<class Alloc, tuple-like UTuple>
248
+ constexpr explicit(see below)
249
+ tuple(allocator_arg_t, const Alloc& a, UTuple&&);
250
  ```
251
 
252
+ *Preconditions:* `Alloc` meets the *Cpp17Allocator*
253
+ requirements [[allocator.requirements.general]].
254
 
255
  *Effects:* Equivalent to the preceding constructors except that each
256
  element is constructed with uses-allocator
257
  construction [[allocator.uses.construction]].
258