tmp/tmpi1ff049r/{from.md → to.md}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
## Pairs <a id="pairs">[[pairs]]</a>
|
| 2 |
|
| 3 |
-
###
|
| 4 |
|
| 5 |
The library provides a template for heterogeneous pairs of values. The
|
| 6 |
library also provides a matching function template to simplify their
|
| 7 |
construction and several templates that provide access to `pair` objects
|
| 8 |
as if they were `tuple` objects (see [[tuple.helper]] and
|
|
@@ -64,28 +64,28 @@ namespace std {
|
|
| 64 |
template<class T1, class T2>
|
| 65 |
pair(T1, T2) -> pair<T1, T2>;
|
| 66 |
}
|
| 67 |
```
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
|
| 73 |
The defaulted move and copy constructor, respectively, of `pair` is a
|
| 74 |
constexpr function if and only if all required element-wise
|
| 75 |
initializations for move and copy, respectively, would be
|
| 76 |
constexpr-suitable [[dcl.constexpr]].
|
| 77 |
|
| 78 |
If
|
| 79 |
`(is_trivially_destructible_v<T1> && is_trivially_destructible_v<T2>)`
|
| 80 |
is `true`, then the destructor of `pair` is trivial.
|
| 81 |
|
| 82 |
-
`pair<T, U>` is a structural type [[
|
| 83 |
-
structural types. Two values `p1` and `p2` of type
|
| 84 |
-
template-argument-equivalent [[temp.type]] if and only
|
| 85 |
-
`p2.first` are template-argument-equivalent and
|
| 86 |
-
`p2.second` are template-argument-equivalent.
|
| 87 |
|
| 88 |
``` cpp
|
| 89 |
constexpr explicit(see below) pair();
|
| 90 |
```
|
| 91 |
|
|
@@ -261,12 +261,12 @@ constexpr pair& operator=(pair&& p) noexcept(see below);
|
|
| 261 |
*Constraints:*
|
| 262 |
|
| 263 |
- `is_move_assignable_v<T1>` is `true` and
|
| 264 |
- `is_move_assignable_v<T2>` is `true`.
|
| 265 |
|
| 266 |
-
*Effects:* Assigns
|
| 267 |
-
`
|
| 268 |
|
| 269 |
*Returns:* `*this`.
|
| 270 |
|
| 271 |
*Remarks:* The exception specification is equivalent to:
|
| 272 |
|
|
@@ -295,13 +295,12 @@ template<class U1, class U2> constexpr pair& operator=(pair<U1, U2>&& p);
|
|
| 295 |
*Constraints:*
|
| 296 |
|
| 297 |
- `is_assignable_v<T1&, U1>` is `true` and
|
| 298 |
- `is_assignable_v<T2&, U2>` is `true`.
|
| 299 |
|
| 300 |
-
*Effects:* Assigns
|
| 301 |
-
`second`
|
| 302 |
-
`std::forward<U2>(p.second)`.
|
| 303 |
|
| 304 |
*Returns:* `*this`.
|
| 305 |
|
| 306 |
``` cpp
|
| 307 |
template<pair-like P> constexpr pair& operator=(P&& p);
|
|
@@ -382,12 +381,13 @@ constexpr void swap(const pair& p) const noexcept(see below);
|
|
| 382 |
``` cpp
|
| 383 |
template<class T1, class T2, class U1, class U2>
|
| 384 |
constexpr bool operator==(const pair<T1, T2>& x, const pair<U1, U2>& y);
|
| 385 |
```
|
| 386 |
|
| 387 |
-
*
|
| 388 |
-
`decltype(x.
|
|
|
|
| 389 |
|
| 390 |
*Returns:* `x.first == y.first && x.second == y.second`.
|
| 391 |
|
| 392 |
``` cpp
|
| 393 |
template<class T1, class T2, class U1, class U2>
|
|
@@ -461,11 +461,11 @@ template<size_t I, class T1, class T2>
|
|
| 461 |
};
|
| 462 |
```
|
| 463 |
|
| 464 |
*Mandates:* `I` < 2.
|
| 465 |
|
| 466 |
-
*
|
| 467 |
|
| 468 |
``` cpp
|
| 469 |
template<size_t I, class T1, class T2>
|
| 470 |
constexpr tuple_element_t<I, pair<T1, T2>>& get(pair<T1, T2>& p) noexcept;
|
| 471 |
template<size_t I, class T1, class T2>
|
|
|
|
| 1 |
## Pairs <a id="pairs">[[pairs]]</a>
|
| 2 |
|
| 3 |
+
### General <a id="pairs.general">[[pairs.general]]</a>
|
| 4 |
|
| 5 |
The library provides a template for heterogeneous pairs of values. The
|
| 6 |
library also provides a matching function template to simplify their
|
| 7 |
construction and several templates that provide access to `pair` objects
|
| 8 |
as if they were `tuple` objects (see [[tuple.helper]] and
|
|
|
|
| 64 |
template<class T1, class T2>
|
| 65 |
pair(T1, T2) -> pair<T1, T2>;
|
| 66 |
}
|
| 67 |
```
|
| 68 |
|
| 69 |
+
Member functions of `pair` do not throw exceptions unless one of the
|
| 70 |
+
element-wise operations specified to be called for that operation throws
|
| 71 |
+
an exception.
|
| 72 |
|
| 73 |
The defaulted move and copy constructor, respectively, of `pair` is a
|
| 74 |
constexpr function if and only if all required element-wise
|
| 75 |
initializations for move and copy, respectively, would be
|
| 76 |
constexpr-suitable [[dcl.constexpr]].
|
| 77 |
|
| 78 |
If
|
| 79 |
`(is_trivially_destructible_v<T1> && is_trivially_destructible_v<T2>)`
|
| 80 |
is `true`, then the destructor of `pair` is trivial.
|
| 81 |
|
| 82 |
+
`pair<T, U>` is a structural type [[term.structural.type]] if `T` and
|
| 83 |
+
`U` are both structural types. Two values `p1` and `p2` of type
|
| 84 |
+
`pair<T, U>` are template-argument-equivalent [[temp.type]] if and only
|
| 85 |
+
if `p1.first` and `p2.first` are template-argument-equivalent and
|
| 86 |
+
`p1.second` and `p2.second` are template-argument-equivalent.
|
| 87 |
|
| 88 |
``` cpp
|
| 89 |
constexpr explicit(see below) pair();
|
| 90 |
```
|
| 91 |
|
|
|
|
| 261 |
*Constraints:*
|
| 262 |
|
| 263 |
- `is_move_assignable_v<T1>` is `true` and
|
| 264 |
- `is_move_assignable_v<T2>` is `true`.
|
| 265 |
|
| 266 |
+
*Effects:* Assigns `std::forward<T1>(p.first)` to `first` and
|
| 267 |
+
`std::forward<T2>(p.second)` to `second`.
|
| 268 |
|
| 269 |
*Returns:* `*this`.
|
| 270 |
|
| 271 |
*Remarks:* The exception specification is equivalent to:
|
| 272 |
|
|
|
|
| 295 |
*Constraints:*
|
| 296 |
|
| 297 |
- `is_assignable_v<T1&, U1>` is `true` and
|
| 298 |
- `is_assignable_v<T2&, U2>` is `true`.
|
| 299 |
|
| 300 |
+
*Effects:* Assigns `std::forward<U1>(p.first)` `first` and
|
| 301 |
+
`std::forward<U2>(p.second)` to `second`.
|
|
|
|
| 302 |
|
| 303 |
*Returns:* `*this`.
|
| 304 |
|
| 305 |
``` cpp
|
| 306 |
template<pair-like P> constexpr pair& operator=(P&& p);
|
|
|
|
| 381 |
``` cpp
|
| 382 |
template<class T1, class T2, class U1, class U2>
|
| 383 |
constexpr bool operator==(const pair<T1, T2>& x, const pair<U1, U2>& y);
|
| 384 |
```
|
| 385 |
|
| 386 |
+
*Constraints:* `x.first == y.first` and `x.second == y.second` are valid
|
| 387 |
+
expressions and each of `decltype(x.first == y.first)` and
|
| 388 |
+
`decltype(x.second == y.second)` models *`boolean- testable`*.
|
| 389 |
|
| 390 |
*Returns:* `x.first == y.first && x.second == y.second`.
|
| 391 |
|
| 392 |
``` cpp
|
| 393 |
template<class T1, class T2, class U1, class U2>
|
|
|
|
| 461 |
};
|
| 462 |
```
|
| 463 |
|
| 464 |
*Mandates:* `I` < 2.
|
| 465 |
|
| 466 |
+
*Result:* The type `T1` if `I` is 0, otherwise the type `T2`.
|
| 467 |
|
| 468 |
``` cpp
|
| 469 |
template<size_t I, class T1, class T2>
|
| 470 |
constexpr tuple_element_t<I, pair<T1, T2>>& get(pair<T1, T2>& p) noexcept;
|
| 471 |
template<size_t I, class T1, class T2>
|