tmp/tmp3jypwr6o/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Assignment <a id="indirect.assign">[[indirect.assign]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
constexpr indirect& operator=(const indirect& other);
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
*Mandates:*
|
| 8 |
+
|
| 9 |
+
- `is_copy_assignable_v<T>` is `true`, and
|
| 10 |
+
- `is_copy_constructible_v<T>` is `true`.
|
| 11 |
+
|
| 12 |
+
*Effects:* If `addressof(other) == this` is `true`, there are no
|
| 13 |
+
effects. Otherwise:
|
| 14 |
+
|
| 15 |
+
- The allocator needs updating if
|
| 16 |
+
`allocator_traits<Allocator>::propagate_on_container_copy_assignment::value`
|
| 17 |
+
is `true`.
|
| 18 |
+
- If `other` is valueless, `*this` becomes valueless and the owned
|
| 19 |
+
object in `*this`, if any, is destroyed using
|
| 20 |
+
`allocator_traits<Allocator>::destroy` and then the storage is
|
| 21 |
+
deallocated.
|
| 22 |
+
- Otherwise, if *`alloc`*` == other.`*`alloc`* is `true` and `*this` is
|
| 23 |
+
not valueless, equivalent to `**this = *other`.
|
| 24 |
+
- Otherwise a new owned object is constructed in `*this` using
|
| 25 |
+
`allocator_traits<Allocator>::construct` with the owned object from
|
| 26 |
+
`other` as the argument, using either the allocator in `*this` or the
|
| 27 |
+
allocator in `other` if the allocator needs updating.
|
| 28 |
+
- The previously owned object in `*this`, if any, is destroyed using
|
| 29 |
+
`allocator_traits<Allocator>::destroy` and then the storage is
|
| 30 |
+
deallocated.
|
| 31 |
+
- If the allocator needs updating, the allocator in `*this` is replaced
|
| 32 |
+
with a copy of the allocator in `other`.
|
| 33 |
+
|
| 34 |
+
*Returns:* A reference to `*this`.
|
| 35 |
+
|
| 36 |
+
*Remarks:* If any exception is thrown, the result of the expression
|
| 37 |
+
`this->valueless_after_move()` remains unchanged. If an exception is
|
| 38 |
+
thrown during the call to `T`’s selected copy constructor, no effect. If
|
| 39 |
+
an exception is thrown during the call to `T`’s copy assignment, the
|
| 40 |
+
state of its owned object is as defined by the exception safety
|
| 41 |
+
guarantee of `T`’s copy assignment.
|
| 42 |
+
|
| 43 |
+
``` cpp
|
| 44 |
+
constexpr indirect& operator=(indirect&& other)
|
| 45 |
+
noexcept(allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
|
| 46 |
+
allocator_traits<Allocator>::is_always_equal::value);
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
*Mandates:* `is_copy_constructible_v<T>` is `true`.
|
| 50 |
+
|
| 51 |
+
*Effects:* If `addressof(other) == this` is `true`, there are no
|
| 52 |
+
effects. Otherwise:
|
| 53 |
+
|
| 54 |
+
- The allocator needs updating if
|
| 55 |
+
`allocator_traits<Allocator>::propagate_on_container_move_assignment::value`
|
| 56 |
+
is `true`.
|
| 57 |
+
- If `other` is valueless, `*this` becomes valueless and the owned
|
| 58 |
+
object in `*this`, if any, is destroyed using
|
| 59 |
+
`allocator_traits<Allocator>::destroy` and then the storage is
|
| 60 |
+
deallocated.
|
| 61 |
+
- Otherwise, if *`alloc`*` == other.`*`alloc`* is `true`, swaps the
|
| 62 |
+
owned objects in `*this` and `other`; the owned object in `other`, if
|
| 63 |
+
any, is then destroyed using `allocator_traits<Allocator>::destroy`
|
| 64 |
+
and then the storage is deallocated.
|
| 65 |
+
- Otherwise, constructs a new owned object with the owned object of
|
| 66 |
+
`other` as the argument as an rvalue, using either the allocator in
|
| 67 |
+
`*this` or the allocator in `other` if the allocator needs updating.
|
| 68 |
+
- The previously owned object in `*this`, if any, is destroyed using
|
| 69 |
+
`allocator_traits<Allocator>::destroy` and then the storage is
|
| 70 |
+
deallocated.
|
| 71 |
+
- If the allocator needs updating, the allocator in `*this` is replaced
|
| 72 |
+
with a copy of the allocator in `other`.
|
| 73 |
+
|
| 74 |
+
*Ensures:* `other` is valueless.
|
| 75 |
+
|
| 76 |
+
*Returns:* A reference to `*this`.
|
| 77 |
+
|
| 78 |
+
*Remarks:* If any exception is thrown, there are no effects on `*this`
|
| 79 |
+
or `other`.
|
| 80 |
+
|
| 81 |
+
``` cpp
|
| 82 |
+
template<class U = T>
|
| 83 |
+
constexpr indirect& operator=(U&& u);
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
*Constraints:*
|
| 87 |
+
|
| 88 |
+
- `is_same_v<remove_cvref_t<U>, indirect>` is `false`,
|
| 89 |
+
- `is_constructible_v<T, U>` is `true`, and
|
| 90 |
+
- `is_assignable_v<T&, U>` is `true`.
|
| 91 |
+
|
| 92 |
+
*Effects:* If `*this` is valueless then constructs an owned object of
|
| 93 |
+
type `T` with `std::forward<U>(u)` using the allocator *alloc*.
|
| 94 |
+
Otherwise, equivalent to `**this = std::forward<U>(u)`.
|
| 95 |
+
|
| 96 |
+
*Returns:* A reference to `*this`.
|
| 97 |
+
|