tmp/tmp_1e9knmz/{from.md → to.md}
RENAMED
|
@@ -1,15 +1,21 @@
|
|
| 1 |
### `exchange` <a id="utility.exchange">[[utility.exchange]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class T, class U = T>
|
| 5 |
-
constexpr T exchange(T& obj, U&& new_val);
|
| 6 |
```
|
| 7 |
|
| 8 |
*Effects:* Equivalent to:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
T old_val = std::move(obj);
|
| 12 |
obj = std::forward<U>(new_val);
|
| 13 |
return old_val;
|
| 14 |
```
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
### `exchange` <a id="utility.exchange">[[utility.exchange]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class T, class U = T>
|
| 5 |
+
constexpr T exchange(T& obj, U&& new_val) noexcept(see below);
|
| 6 |
```
|
| 7 |
|
| 8 |
*Effects:* Equivalent to:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
T old_val = std::move(obj);
|
| 12 |
obj = std::forward<U>(new_val);
|
| 13 |
return old_val;
|
| 14 |
```
|
| 15 |
|
| 16 |
+
*Remarks:* The exception specification is equivalent to:
|
| 17 |
+
|
| 18 |
+
``` cpp
|
| 19 |
+
is_nothrow_move_constructible_v<T> && is_nothrow_assignable_v<T&, U>
|
| 20 |
+
```
|
| 21 |
+
|