- tmp/tmp5m1mwkm6/{from.md → to.md} +118 -81
tmp/tmp5m1mwkm6/{from.md → to.md}
RENAMED
|
@@ -10,122 +10,157 @@ namespace std {
|
|
| 10 |
T1 first;
|
| 11 |
T2 second;
|
| 12 |
|
| 13 |
pair(const pair&) = default;
|
| 14 |
pair(pair&&) = default;
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
template<class... Args1, class... Args2>
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
pair& operator=(pair&
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
|
| 29 |
};
|
| 30 |
|
| 31 |
template<class T1, class T2>
|
| 32 |
pair(T1, T2) -> pair<T1, T2>;
|
| 33 |
}
|
| 34 |
```
|
| 35 |
|
| 36 |
-
Constructors and member functions of `pair`
|
| 37 |
unless one of the element-wise operations specified to be called for
|
| 38 |
that operation throws an exception.
|
| 39 |
|
| 40 |
-
The defaulted move and copy constructor, respectively, of `pair`
|
| 41 |
-
|
| 42 |
-
initializations for
|
| 43 |
-
requirements for a constexpr function.
|
| 44 |
-
|
|
|
|
| 45 |
`(is_trivially_destructible_v<T1> && is_trivially_destructible_v<T2>)`
|
| 46 |
-
is `true`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
``` cpp
|
| 49 |
-
|
| 50 |
```
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
*Effects:* Value-initializes `first` and `second`.
|
| 53 |
|
| 54 |
-
*Remarks:*
|
| 55 |
-
|
| 56 |
-
|
| 57 |
|
| 58 |
-
[*Note 1*: This behavior can be implemented
|
| 59 |
-
with default template arguments. — *end note*]
|
| 60 |
-
|
| 61 |
-
The constructor is explicit if and only if either `first_type` or
|
| 62 |
-
`second_type` is not implicitly default-constructible.
|
| 63 |
-
|
| 64 |
-
[*Note 2*: This behavior can be implemented with a trait that checks
|
| 65 |
whether a `const first_type&` or a `const second_type&` can be
|
| 66 |
initialized with `{}`. — *end note*]
|
| 67 |
|
| 68 |
``` cpp
|
| 69 |
-
|
| 70 |
```
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
*Effects:* Initializes `first` with `x` and `second` with `y`.
|
| 73 |
|
| 74 |
-
*Remarks:*
|
| 75 |
-
unless `is_copy_constructible_v<first_type>` is `true` and
|
| 76 |
-
`is_copy_constructible_v<second_type>` is `true`. The constructor is
|
| 77 |
-
explicit if and only if
|
| 78 |
-
`is_convertible_v<const first_type&, first_type>` is `false` or
|
| 79 |
-
`is_convertible_v<const second_type&, second_type>` is `false`.
|
| 80 |
|
| 81 |
``` cpp
|
| 82 |
-
|
|
|
|
| 83 |
```
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
*Effects:* Initializes `first` with `std::forward<U1>(x)` and `second`
|
| 86 |
with `std::forward<U2>(y)`.
|
| 87 |
|
| 88 |
-
*Remarks:*
|
| 89 |
-
unless `is_constructible_v<first_type, U1&&>` is `true` and
|
| 90 |
-
`is_constructible_v<second_type, U2&&>` is `true`. The constructor is
|
| 91 |
-
explicit if and only if `is_convertible_v<U1&&, first_type>` is `false`
|
| 92 |
-
or `is_convertible_v<U2&&, second_type>` is `false`.
|
| 93 |
|
| 94 |
``` cpp
|
| 95 |
-
|
| 96 |
```
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
*Effects:* Initializes members from the corresponding members of the
|
| 99 |
argument.
|
| 100 |
|
| 101 |
-
*Remarks:*
|
| 102 |
-
unless `is_constructible_v<first_type, const U1&>` is `true` and
|
| 103 |
-
`is_constructible_v<second_type, const U2&>` is `true`. The constructor
|
| 104 |
-
is explicit if and only if `is_convertible_v<const U1&, first_type>` is
|
| 105 |
-
`false` or `is_convertible_v<const U2&, second_type>` is `false`.
|
| 106 |
|
| 107 |
``` cpp
|
| 108 |
-
|
| 109 |
```
|
| 110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
*Effects:* Initializes `first` with `std::forward<U1>(p.first)` and
|
| 112 |
`second` with `std::forward<U2>(p.second)`.
|
| 113 |
|
| 114 |
-
*Remarks:*
|
| 115 |
-
|
| 116 |
-
`
|
| 117 |
-
|
| 118 |
-
|
| 119 |
|
| 120 |
``` cpp
|
| 121 |
template<class... Args1, class... Args2>
|
| 122 |
-
pair(piecewise_construct_t,
|
|
|
|
| 123 |
```
|
| 124 |
|
| 125 |
-
*
|
| 126 |
-
|
|
|
|
|
|
|
| 127 |
|
| 128 |
*Effects:* Initializes `first` with arguments of types `Args1...`
|
| 129 |
obtained by forwarding the elements of `first_args` and initializes
|
| 130 |
`second` with arguments of types `Args2...` obtained by forwarding the
|
| 131 |
elements of `second_args`. (Here, forwarding an element `x` of type `U`
|
|
@@ -133,74 +168,76 @@ within a `tuple` object means calling `std::forward<U>(x)`.) This form
|
|
| 133 |
of construction, whereby constructor arguments for `first` and `second`
|
| 134 |
are each provided in a separate `tuple` object, is called *piecewise
|
| 135 |
construction*.
|
| 136 |
|
| 137 |
``` cpp
|
| 138 |
-
pair& operator=(const pair& p);
|
| 139 |
```
|
| 140 |
|
| 141 |
*Effects:* Assigns `p.first` to `first` and `p.second` to `second`.
|
| 142 |
|
| 143 |
-
*Remarks:* This operator
|
| 144 |
`is_copy_assignable_v<first_type>` is `true` and
|
| 145 |
`is_copy_assignable_v<second_type>` is `true`.
|
| 146 |
|
| 147 |
*Returns:* `*this`.
|
| 148 |
|
| 149 |
``` cpp
|
| 150 |
-
template<class U1, class U2> pair& operator=(const pair<U1, U2>& p);
|
| 151 |
```
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
*Effects:* Assigns `p.first` to `first` and `p.second` to `second`.
|
| 154 |
|
| 155 |
-
*Remarks:* This operator shall not participate in overload resolution
|
| 156 |
-
unless `is_assignable_v<first_type&, const U1&>` is `true` and
|
| 157 |
-
`is_assignable_v<second_type&, const U2&>` is `true`.
|
| 158 |
-
|
| 159 |
*Returns:* `*this`.
|
| 160 |
|
| 161 |
``` cpp
|
| 162 |
-
pair& operator=(pair&& p) noexcept(see below);
|
| 163 |
```
|
| 164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
*Effects:* Assigns to `first` with `std::forward<first_type>(p.first)`
|
| 166 |
and to `second` with
|
| 167 |
`std::forward<second_type>(p.second)`.
|
| 168 |
|
| 169 |
-
*
|
| 170 |
-
`is_move_assignable_v<first_type>` is `true` and
|
| 171 |
-
`is_move_assignable_v<second_type>` is `true`.
|
| 172 |
|
| 173 |
*Remarks:* The expression inside `noexcept` is equivalent to:
|
| 174 |
|
| 175 |
``` cpp
|
| 176 |
is_nothrow_move_assignable_v<T1> && is_nothrow_move_assignable_v<T2>
|
| 177 |
```
|
| 178 |
|
| 179 |
-
*Returns:* `*this`.
|
| 180 |
-
|
| 181 |
``` cpp
|
| 182 |
-
template<class U1, class U2> pair& operator=(pair<U1, U2>&& p);
|
| 183 |
```
|
| 184 |
|
| 185 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
`second` with
|
| 187 |
-
`std::forward<
|
| 188 |
-
|
| 189 |
-
*Remarks:* This operator shall not participate in overload resolution
|
| 190 |
-
unless `is_assignable_v<first_type&, U1&&>` is `true` and
|
| 191 |
-
`is_assignable_v<second_type&, U2&&>` is `true`.
|
| 192 |
|
| 193 |
*Returns:* `*this`.
|
| 194 |
|
| 195 |
``` cpp
|
| 196 |
-
void swap(pair& p) noexcept(see below);
|
| 197 |
```
|
| 198 |
|
| 199 |
-
*
|
| 200 |
-
|
| 201 |
-
swappable with `p.second`.
|
| 202 |
|
| 203 |
*Effects:* Swaps `first` with `p.first` and `second` with `p.second`.
|
| 204 |
|
| 205 |
*Remarks:* The expression inside `noexcept` is equivalent to:
|
| 206 |
|
|
|
|
| 10 |
T1 first;
|
| 11 |
T2 second;
|
| 12 |
|
| 13 |
pair(const pair&) = default;
|
| 14 |
pair(pair&&) = default;
|
| 15 |
+
constexpr explicit(see below) pair();
|
| 16 |
+
constexpr explicit(see below) pair(const T1& x, const T2& y);
|
| 17 |
+
template<class U1, class U2>
|
| 18 |
+
constexpr explicit(see below) pair(U1&& x, U2&& y);
|
| 19 |
+
template<class U1, class U2>
|
| 20 |
+
constexpr explicit(see below) pair(const pair<U1, U2>& p);
|
| 21 |
+
template<class U1, class U2>
|
| 22 |
+
constexpr explicit(see below) pair(pair<U1, U2>&& p);
|
| 23 |
template<class... Args1, class... Args2>
|
| 24 |
+
constexpr pair(piecewise_construct_t,
|
| 25 |
+
tuple<Args1...> first_args, tuple<Args2...> second_args);
|
| 26 |
|
| 27 |
+
constexpr pair& operator=(const pair& p);
|
| 28 |
+
template<class U1, class U2>
|
| 29 |
+
constexpr pair& operator=(const pair<U1, U2>& p);
|
| 30 |
+
constexpr pair& operator=(pair&& p) noexcept(see below);
|
| 31 |
+
template<class U1, class U2>
|
| 32 |
+
constexpr pair& operator=(pair<U1, U2>&& p);
|
| 33 |
|
| 34 |
+
constexpr void swap(pair& p) noexcept(see below);
|
| 35 |
};
|
| 36 |
|
| 37 |
template<class T1, class T2>
|
| 38 |
pair(T1, T2) -> pair<T1, T2>;
|
| 39 |
}
|
| 40 |
```
|
| 41 |
|
| 42 |
+
Constructors and member functions of `pair` do not throw exceptions
|
| 43 |
unless one of the element-wise operations specified to be called for
|
| 44 |
that operation throws an exception.
|
| 45 |
|
| 46 |
+
The defaulted move and copy constructor, respectively, of `pair` is a
|
| 47 |
+
constexpr function if and only if all required element-wise
|
| 48 |
+
initializations for move and copy, respectively, would satisfy the
|
| 49 |
+
requirements for a constexpr function.
|
| 50 |
+
|
| 51 |
+
If
|
| 52 |
`(is_trivially_destructible_v<T1> && is_trivially_destructible_v<T2>)`
|
| 53 |
+
is `true`, then the destructor of `pair` is trivial.
|
| 54 |
+
|
| 55 |
+
`pair<T, U>` is a structural type [[temp.param]] if `T` and `U` are both
|
| 56 |
+
structural types. Two values `p1` and `p2` of type `pair<T, U>` are
|
| 57 |
+
template-argument-equivalent [[temp.type]] if and only if `p1.first` and
|
| 58 |
+
`p2.first` are template-argument-equivalent and `p1.second` and
|
| 59 |
+
`p2.second` are template-argument-equivalent.
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
+
constexpr explicit(see below) pair();
|
| 63 |
```
|
| 64 |
|
| 65 |
+
*Constraints:*
|
| 66 |
+
|
| 67 |
+
- `is_default_constructible_v<first_type>` is `true` and
|
| 68 |
+
- `is_default_constructible_v<second_type>` is `true`.
|
| 69 |
+
|
| 70 |
*Effects:* Value-initializes `first` and `second`.
|
| 71 |
|
| 72 |
+
*Remarks:* The expression inside `explicit` evaluates to `true` if and
|
| 73 |
+
only if either `first_type` or `second_type` is not implicitly
|
| 74 |
+
default-constructible.
|
| 75 |
|
| 76 |
+
[*Note 1*: This behavior can be implemented with a trait that checks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
whether a `const first_type&` or a `const second_type&` can be
|
| 78 |
initialized with `{}`. — *end note*]
|
| 79 |
|
| 80 |
``` cpp
|
| 81 |
+
constexpr explicit(see below) pair(const T1& x, const T2& y);
|
| 82 |
```
|
| 83 |
|
| 84 |
+
*Constraints:*
|
| 85 |
+
|
| 86 |
+
- `is_copy_constructible_v<first_type>` is `true` and
|
| 87 |
+
- `is_copy_constructible_v<second_type>` is `true`.
|
| 88 |
+
|
| 89 |
*Effects:* Initializes `first` with `x` and `second` with `y`.
|
| 90 |
|
| 91 |
+
*Remarks:* The expression inside `explicit` is equivalent to:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
``` cpp
|
| 94 |
+
!is_convertible_v<const first_type&, first_type> ||
|
| 95 |
+
!is_convertible_v<const second_type&, second_type>
|
| 96 |
```
|
| 97 |
|
| 98 |
+
``` cpp
|
| 99 |
+
template<class U1, class U2> constexpr explicit(see below) pair(U1&& x, U2&& y);
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
*Constraints:*
|
| 103 |
+
|
| 104 |
+
- `is_constructible_v<first_type, U1>` is `true` and
|
| 105 |
+
- `is_constructible_v<second_type, U2>` is `true`.
|
| 106 |
+
|
| 107 |
*Effects:* Initializes `first` with `std::forward<U1>(x)` and `second`
|
| 108 |
with `std::forward<U2>(y)`.
|
| 109 |
|
| 110 |
+
*Remarks:* The expression inside `explicit` is equivalent to:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
``` cpp
|
| 113 |
+
!is_convertible_v<U1, first_type> || !is_convertible_v<U2, second_type>
|
| 114 |
```
|
| 115 |
|
| 116 |
+
``` cpp
|
| 117 |
+
template<class U1, class U2> constexpr explicit(see below) pair(const pair<U1, U2>& p);
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
*Constraints:*
|
| 121 |
+
|
| 122 |
+
- `is_constructible_v<first_type, const U1&>` is `true` and
|
| 123 |
+
- `is_constructible_v<second_type, const U2&>` is `true`.
|
| 124 |
+
|
| 125 |
*Effects:* Initializes members from the corresponding members of the
|
| 126 |
argument.
|
| 127 |
|
| 128 |
+
*Remarks:* The expression inside explicit is equivalent to:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
``` cpp
|
| 131 |
+
!is_convertible_v<const U1&, first_type> || !is_convertible_v<const U2&, second_type>
|
| 132 |
```
|
| 133 |
|
| 134 |
+
``` cpp
|
| 135 |
+
template<class U1, class U2> constexpr explicit(see below) pair(pair<U1, U2>&& p);
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
*Constraints:*
|
| 139 |
+
|
| 140 |
+
- `is_constructible_v<first_type, U1>` is `true` and
|
| 141 |
+
- `is_constructible_v<second_type, U2>` is `true`.
|
| 142 |
+
|
| 143 |
*Effects:* Initializes `first` with `std::forward<U1>(p.first)` and
|
| 144 |
`second` with `std::forward<U2>(p.second)`.
|
| 145 |
|
| 146 |
+
*Remarks:* The expression inside explicit is equivalent to:
|
| 147 |
+
|
| 148 |
+
``` cpp
|
| 149 |
+
!is_convertible_v<U1, first_type> || !is_convertible_v<U2, second_type>
|
| 150 |
+
```
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
template<class... Args1, class... Args2>
|
| 154 |
+
constexpr pair(piecewise_construct_t,
|
| 155 |
+
tuple<Args1...> first_args, tuple<Args2...> second_args);
|
| 156 |
```
|
| 157 |
|
| 158 |
+
*Mandates:*
|
| 159 |
+
|
| 160 |
+
- `is_constructible_v<first_type, Args1...>` is `true` and
|
| 161 |
+
- `is_constructible_v<second_type, Args2...>` is `true`.
|
| 162 |
|
| 163 |
*Effects:* Initializes `first` with arguments of types `Args1...`
|
| 164 |
obtained by forwarding the elements of `first_args` and initializes
|
| 165 |
`second` with arguments of types `Args2...` obtained by forwarding the
|
| 166 |
elements of `second_args`. (Here, forwarding an element `x` of type `U`
|
|
|
|
| 168 |
of construction, whereby constructor arguments for `first` and `second`
|
| 169 |
are each provided in a separate `tuple` object, is called *piecewise
|
| 170 |
construction*.
|
| 171 |
|
| 172 |
``` cpp
|
| 173 |
+
constexpr pair& operator=(const pair& p);
|
| 174 |
```
|
| 175 |
|
| 176 |
*Effects:* Assigns `p.first` to `first` and `p.second` to `second`.
|
| 177 |
|
| 178 |
+
*Remarks:* This operator is defined as deleted unless
|
| 179 |
`is_copy_assignable_v<first_type>` is `true` and
|
| 180 |
`is_copy_assignable_v<second_type>` is `true`.
|
| 181 |
|
| 182 |
*Returns:* `*this`.
|
| 183 |
|
| 184 |
``` cpp
|
| 185 |
+
template<class U1, class U2> constexpr pair& operator=(const pair<U1, U2>& p);
|
| 186 |
```
|
| 187 |
|
| 188 |
+
*Constraints:*
|
| 189 |
+
|
| 190 |
+
- `is_assignable_v<first_type&, const U1&>` is `true` and
|
| 191 |
+
- `is_assignable_v<second_type&, const U2&>` is `true`.
|
| 192 |
+
|
| 193 |
*Effects:* Assigns `p.first` to `first` and `p.second` to `second`.
|
| 194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
*Returns:* `*this`.
|
| 196 |
|
| 197 |
``` cpp
|
| 198 |
+
constexpr pair& operator=(pair&& p) noexcept(see below);
|
| 199 |
```
|
| 200 |
|
| 201 |
+
*Constraints:*
|
| 202 |
+
|
| 203 |
+
- `is_move_assignable_v<first_type>` is `true` and
|
| 204 |
+
- `is_move_assignable_v<second_type>` is `true`.
|
| 205 |
+
|
| 206 |
*Effects:* Assigns to `first` with `std::forward<first_type>(p.first)`
|
| 207 |
and to `second` with
|
| 208 |
`std::forward<second_type>(p.second)`.
|
| 209 |
|
| 210 |
+
*Returns:* `*this`.
|
|
|
|
|
|
|
| 211 |
|
| 212 |
*Remarks:* The expression inside `noexcept` is equivalent to:
|
| 213 |
|
| 214 |
``` cpp
|
| 215 |
is_nothrow_move_assignable_v<T1> && is_nothrow_move_assignable_v<T2>
|
| 216 |
```
|
| 217 |
|
|
|
|
|
|
|
| 218 |
``` cpp
|
| 219 |
+
template<class U1, class U2> constexpr pair& operator=(pair<U1, U2>&& p);
|
| 220 |
```
|
| 221 |
|
| 222 |
+
*Constraints:*
|
| 223 |
+
|
| 224 |
+
- `is_assignable_v<first_type&, U1>` is `true` and
|
| 225 |
+
- `is_assignable_v<second_type&, U2>` is `true`.
|
| 226 |
+
|
| 227 |
+
*Effects:* Assigns to `first` with `std::forward<U1>(p.first)` and to
|
| 228 |
`second` with
|
| 229 |
+
`std::forward<U2>(p.second)`.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
|
| 231 |
*Returns:* `*this`.
|
| 232 |
|
| 233 |
``` cpp
|
| 234 |
+
constexpr void swap(pair& p) noexcept(see below);
|
| 235 |
```
|
| 236 |
|
| 237 |
+
*Preconditions:* `first` is swappable with [[swappable.requirements]]
|
| 238 |
+
`p.first` and `second` is swappable with `p.second`.
|
|
|
|
| 239 |
|
| 240 |
*Effects:* Swaps `first` with `p.first` and `second` with `p.second`.
|
| 241 |
|
| 242 |
*Remarks:* The expression inside `noexcept` is equivalent to:
|
| 243 |
|