tmp/tmpvda0ou8p/{from.md → to.md}
RENAMED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
### Class template `tuple` <a id="tuple.tuple">[[tuple.tuple]]</a>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class... Types>
|
| 6 |
class tuple {
|
| 7 |
public:
|
|
@@ -123,10 +125,13 @@ namespace std {
|
|
| 123 |
template<class Alloc, class... UTypes>
|
| 124 |
tuple(allocator_arg_t, Alloc, tuple<UTypes...>) -> tuple<UTypes...>;
|
| 125 |
}
|
| 126 |
```
|
| 127 |
|
|
|
|
|
|
|
|
|
|
| 128 |
#### Construction <a id="tuple.cnstr">[[tuple.cnstr]]</a>
|
| 129 |
|
| 130 |
In the descriptions that follow, let i be in the range \[`0`,
|
| 131 |
`sizeof...(Types)`) in order, `Tᵢ` be the iᵗʰ type in `Types`, and `Uᵢ`
|
| 132 |
be the iᵗʰ type in a template parameter pack named `UTypes`, where
|
|
@@ -237,11 +242,11 @@ template<class... UTypes> constexpr explicit(see below) tuple(tuple<UTypes...>&
|
|
| 237 |
template<class... UTypes> constexpr explicit(see below) tuple(const tuple<UTypes...>& u);
|
| 238 |
template<class... UTypes> constexpr explicit(see below) tuple(tuple<UTypes...>&& u);
|
| 239 |
template<class... UTypes> constexpr explicit(see below) tuple(const tuple<UTypes...>&& u);
|
| 240 |
```
|
| 241 |
|
| 242 |
-
Let `I` be the pack `0, 1,
|
| 243 |
*`FWD`*`(u)` be `static_cast<decltype(u)>(u)`.
|
| 244 |
|
| 245 |
*Constraints:*
|
| 246 |
|
| 247 |
- `sizeof...(Types)` equals `sizeof...(UTypes)`, and
|
|
@@ -308,21 +313,21 @@ is `true`.
|
|
| 308 |
``` cpp
|
| 309 |
template<tuple-like UTuple>
|
| 310 |
constexpr explicit(see below) tuple(UTuple&& u);
|
| 311 |
```
|
| 312 |
|
| 313 |
-
Let `I` be the pack `0, 1, …, (sizeof...(Types) - 1)`.
|
| 314 |
|
| 315 |
*Constraints:*
|
| 316 |
|
| 317 |
- `different-from<UTuple, tuple>` [[range.utility.helpers]] is `true`,
|
| 318 |
- `remove_cvref_t<UTuple>` is not a specialization of
|
| 319 |
`ranges::subrange`,
|
| 320 |
- `sizeof...(Types)` equals `tuple_size_v<remove_cvref_t<UTuple>>`,
|
| 321 |
- `(is_constructible_v<Types, decltype(get<I>(std::forward<UTuple>(u)))> && ...)`
|
| 322 |
is `true`, and
|
| 323 |
-
- either `sizeof...(Types)` is not
|
| 324 |
`T`) `is_convertible_v<UTuple, T>` and `is_constructible_v<T, UTuple>`
|
| 325 |
are both `false`.
|
| 326 |
|
| 327 |
*Effects:* For all i, initializes the iᵗʰ element of `*this` with
|
| 328 |
`get<`i`>(std::forward<UTuple>(u))`.
|
|
@@ -331,10 +336,19 @@ Let `I` be the pack `0, 1, …, (sizeof...(Types) - 1)`.
|
|
| 331 |
|
| 332 |
``` cpp
|
| 333 |
!(is_convertible_v<decltype(get<I>(std::forward<UTuple>(u))), Types> && ...)
|
| 334 |
```
|
| 335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
``` cpp
|
| 337 |
template<class Alloc>
|
| 338 |
constexpr explicit(see below)
|
| 339 |
tuple(allocator_arg_t, const Alloc& a);
|
| 340 |
template<class Alloc>
|
|
@@ -573,11 +587,11 @@ template<tuple-like UTuple>
|
|
| 573 |
*Constraints:*
|
| 574 |
|
| 575 |
- `different-from<UTuple, tuple>` [[range.utility.helpers]] is `true`,
|
| 576 |
- `remove_cvref_t<UTuple>` is not a specialization of
|
| 577 |
`ranges::subrange`,
|
| 578 |
-
- `sizeof...(Types)` equals `tuple_size_v<remove_cvref_t<UTuple>>`, and
|
| 579 |
- `is_assignable_v<``Tᵢ``&, decltype(get<`i`>(std::forward<UTuple>(u)))>`
|
| 580 |
is `true` for all i.
|
| 581 |
|
| 582 |
*Effects:* For all i, assigns `get<`i`>(std::forward<UTuple>(u))` to
|
| 583 |
`get<`i`>(*this)`.
|
|
@@ -592,11 +606,11 @@ template<tuple-like UTuple>
|
|
| 592 |
*Constraints:*
|
| 593 |
|
| 594 |
- `different-from<UTuple, tuple>` [[range.utility.helpers]] is `true`,
|
| 595 |
- `remove_cvref_t<UTuple>` is not a specialization of
|
| 596 |
`ranges::subrange`,
|
| 597 |
-
- `sizeof...(Types)` equals `tuple_size_v<remove_cvref_t<UTuple>>`, and
|
| 598 |
- `is_assignable_v<const ``Tᵢ``&, decltype(get<`i`>(std::forward<UTuple>(u)))>`
|
| 599 |
is `true` for all i.
|
| 600 |
|
| 601 |
*Effects:* For all i, assigns `get<`i`>(std::forward<UTuple>(u))` to
|
| 602 |
`get<`i`>(*this)`.
|
|
@@ -619,11 +633,11 @@ Let i be in the range \[`0`, `sizeof...(Types)`) in order.
|
|
| 619 |
`true`.
|
| 620 |
|
| 621 |
*Preconditions:* For all i, `get<`i`>(*this)` is swappable
|
| 622 |
with [[swappable.requirements]] `get<`i`>(rhs)`.
|
| 623 |
|
| 624 |
-
*Effects:* For each i, calls `swap` for `get<`i`>(*this)`
|
| 625 |
`get<`i`>(rhs)`.
|
| 626 |
|
| 627 |
*Throws:* Nothing unless one of the element-wise `swap` calls throws an
|
| 628 |
exception.
|
| 629 |
|
|
|
|
| 1 |
### Class template `tuple` <a id="tuple.tuple">[[tuple.tuple]]</a>
|
| 2 |
|
| 3 |
+
#### General <a id="tuple.tuple.general">[[tuple.tuple.general]]</a>
|
| 4 |
+
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
template<class... Types>
|
| 8 |
class tuple {
|
| 9 |
public:
|
|
|
|
| 125 |
template<class Alloc, class... UTypes>
|
| 126 |
tuple(allocator_arg_t, Alloc, tuple<UTypes...>) -> tuple<UTypes...>;
|
| 127 |
}
|
| 128 |
```
|
| 129 |
|
| 130 |
+
If a program declares an explicit or partial specialization of `tuple`,
|
| 131 |
+
the program is ill-formed, no diagnostic required.
|
| 132 |
+
|
| 133 |
#### Construction <a id="tuple.cnstr">[[tuple.cnstr]]</a>
|
| 134 |
|
| 135 |
In the descriptions that follow, let i be in the range \[`0`,
|
| 136 |
`sizeof...(Types)`) in order, `Tᵢ` be the iᵗʰ type in `Types`, and `Uᵢ`
|
| 137 |
be the iᵗʰ type in a template parameter pack named `UTypes`, where
|
|
|
|
| 242 |
template<class... UTypes> constexpr explicit(see below) tuple(const tuple<UTypes...>& u);
|
| 243 |
template<class... UTypes> constexpr explicit(see below) tuple(tuple<UTypes...>&& u);
|
| 244 |
template<class... UTypes> constexpr explicit(see below) tuple(const tuple<UTypes...>&& u);
|
| 245 |
```
|
| 246 |
|
| 247 |
+
Let `I` be the pack `0, 1, `…`, (sizeof...(Types) - 1)`. Let
|
| 248 |
*`FWD`*`(u)` be `static_cast<decltype(u)>(u)`.
|
| 249 |
|
| 250 |
*Constraints:*
|
| 251 |
|
| 252 |
- `sizeof...(Types)` equals `sizeof...(UTypes)`, and
|
|
|
|
| 313 |
``` cpp
|
| 314 |
template<tuple-like UTuple>
|
| 315 |
constexpr explicit(see below) tuple(UTuple&& u);
|
| 316 |
```
|
| 317 |
|
| 318 |
+
Let `I` be the pack `0, 1, `…`, (sizeof...(Types) - 1)`.
|
| 319 |
|
| 320 |
*Constraints:*
|
| 321 |
|
| 322 |
- `different-from<UTuple, tuple>` [[range.utility.helpers]] is `true`,
|
| 323 |
- `remove_cvref_t<UTuple>` is not a specialization of
|
| 324 |
`ranges::subrange`,
|
| 325 |
- `sizeof...(Types)` equals `tuple_size_v<remove_cvref_t<UTuple>>`,
|
| 326 |
- `(is_constructible_v<Types, decltype(get<I>(std::forward<UTuple>(u)))> && ...)`
|
| 327 |
is `true`, and
|
| 328 |
+
- either `sizeof...(Types)` is not 1, or (when `Types...` expands to
|
| 329 |
`T`) `is_convertible_v<UTuple, T>` and `is_constructible_v<T, UTuple>`
|
| 330 |
are both `false`.
|
| 331 |
|
| 332 |
*Effects:* For all i, initializes the iᵗʰ element of `*this` with
|
| 333 |
`get<`i`>(std::forward<UTuple>(u))`.
|
|
|
|
| 336 |
|
| 337 |
``` cpp
|
| 338 |
!(is_convertible_v<decltype(get<I>(std::forward<UTuple>(u))), Types> && ...)
|
| 339 |
```
|
| 340 |
|
| 341 |
+
The constructor is defined as deleted if
|
| 342 |
+
|
| 343 |
+
``` cpp
|
| 344 |
+
(reference_constructs_from_temporary_v<Types, decltype(get<I>(std::forward<UTuple>(u)))>
|
| 345 |
+
|| ...)
|
| 346 |
+
```
|
| 347 |
+
|
| 348 |
+
is `true`.
|
| 349 |
+
|
| 350 |
``` cpp
|
| 351 |
template<class Alloc>
|
| 352 |
constexpr explicit(see below)
|
| 353 |
tuple(allocator_arg_t, const Alloc& a);
|
| 354 |
template<class Alloc>
|
|
|
|
| 587 |
*Constraints:*
|
| 588 |
|
| 589 |
- `different-from<UTuple, tuple>` [[range.utility.helpers]] is `true`,
|
| 590 |
- `remove_cvref_t<UTuple>` is not a specialization of
|
| 591 |
`ranges::subrange`,
|
| 592 |
+
- `sizeof...(Types)` equals `tuple_size_v<remove_cvref_t<UTuple>>`, and
|
| 593 |
- `is_assignable_v<``Tᵢ``&, decltype(get<`i`>(std::forward<UTuple>(u)))>`
|
| 594 |
is `true` for all i.
|
| 595 |
|
| 596 |
*Effects:* For all i, assigns `get<`i`>(std::forward<UTuple>(u))` to
|
| 597 |
`get<`i`>(*this)`.
|
|
|
|
| 606 |
*Constraints:*
|
| 607 |
|
| 608 |
- `different-from<UTuple, tuple>` [[range.utility.helpers]] is `true`,
|
| 609 |
- `remove_cvref_t<UTuple>` is not a specialization of
|
| 610 |
`ranges::subrange`,
|
| 611 |
+
- `sizeof...(Types)` equals `tuple_size_v<remove_cvref_t<UTuple>>`, and
|
| 612 |
- `is_assignable_v<const ``Tᵢ``&, decltype(get<`i`>(std::forward<UTuple>(u)))>`
|
| 613 |
is `true` for all i.
|
| 614 |
|
| 615 |
*Effects:* For all i, assigns `get<`i`>(std::forward<UTuple>(u))` to
|
| 616 |
`get<`i`>(*this)`.
|
|
|
|
| 633 |
`true`.
|
| 634 |
|
| 635 |
*Preconditions:* For all i, `get<`i`>(*this)` is swappable
|
| 636 |
with [[swappable.requirements]] `get<`i`>(rhs)`.
|
| 637 |
|
| 638 |
+
*Effects:* For each i, calls `swap` for `get<`i`>(*this)` and
|
| 639 |
`get<`i`>(rhs)`.
|
| 640 |
|
| 641 |
*Throws:* Nothing unless one of the element-wise `swap` calls throws an
|
| 642 |
exception.
|
| 643 |
|