tmp/tmpdk_3h7qj/{from.md → to.md}
RENAMED
|
@@ -52,11 +52,11 @@ constexpr optional& operator=(optional&& rhs) noexcept(see below);
|
|
| 52 |
|
| 53 |
**Table: `optional::operator=(optional&&)` effects** <a id="optional.assign.move">[optional.assign.move]</a>
|
| 54 |
|
| 55 |
| | `*this` contains a value | `*this` does not contain a value |
|
| 56 |
| ------------------------------ | ------------------------------------------------------ | ---------------------------------------------------------------------- |
|
| 57 |
-
| `rhs` contains a value | assigns `std::move(
|
| 58 |
| `rhs` does not contain a value | destroys the contained value by calling `val->T::~T()` | no effect |
|
| 59 |
|
| 60 |
|
| 61 |
*Ensures:* `rhs.has_value() == this->has_value()`.
|
| 62 |
|
|
@@ -78,17 +78,19 @@ guarantee of `T`’s move assignment. If
|
|
| 78 |
`is_trivially_move_constructible_v<T> &&`
|
| 79 |
`is_trivially_move_assignable_v<T> &&` `is_trivially_destructible_v<T>`
|
| 80 |
is `true`, this assignment operator is trivial.
|
| 81 |
|
| 82 |
``` cpp
|
| 83 |
-
template<class U = T> constexpr optional
|
| 84 |
```
|
| 85 |
|
| 86 |
-
*Constraints:*
|
| 87 |
-
|
| 88 |
-
`
|
| 89 |
-
`
|
|
|
|
|
|
|
| 90 |
|
| 91 |
*Effects:* If `*this` contains a value, assigns `std::forward<U>(v)` to
|
| 92 |
the contained value; otherwise direct-non-list-initializes the contained
|
| 93 |
value with `std::forward<U>(v)`.
|
| 94 |
|
|
@@ -158,11 +160,11 @@ expression `rhs.has_value()` remains unchanged.
|
|
| 158 |
|
| 159 |
**Table: `optional::operator=(optional<U>&&)` effects** <a id="optional.assign.move.templ">[optional.assign.move.templ]</a>
|
| 160 |
|
| 161 |
| | `*this` contains a value | `*this` does not contain a value |
|
| 162 |
| ------------------------------ | ------------------------------------------------------ | ---------------------------------------------------------------------- |
|
| 163 |
-
| `rhs` contains a value | assigns `std::move(
|
| 164 |
| `rhs` does not contain a value | destroys the contained value by calling `val->T::~T()` | no effect |
|
| 165 |
|
| 166 |
|
| 167 |
*Ensures:* `rhs.has_value() == this->has_value()`.
|
| 168 |
|
|
|
|
| 52 |
|
| 53 |
**Table: `optional::operator=(optional&&)` effects** <a id="optional.assign.move">[optional.assign.move]</a>
|
| 54 |
|
| 55 |
| | `*this` contains a value | `*this` does not contain a value |
|
| 56 |
| ------------------------------ | ------------------------------------------------------ | ---------------------------------------------------------------------- |
|
| 57 |
+
| `rhs` contains a value | assigns `*std::move(rhs)` to the contained value | direct-non-list-initializes the contained value with `*std::move(rhs)` |
|
| 58 |
| `rhs` does not contain a value | destroys the contained value by calling `val->T::~T()` | no effect |
|
| 59 |
|
| 60 |
|
| 61 |
*Ensures:* `rhs.has_value() == this->has_value()`.
|
| 62 |
|
|
|
|
| 78 |
`is_trivially_move_constructible_v<T> &&`
|
| 79 |
`is_trivially_move_assignable_v<T> &&` `is_trivially_destructible_v<T>`
|
| 80 |
is `true`, this assignment operator is trivial.
|
| 81 |
|
| 82 |
``` cpp
|
| 83 |
+
template<class U = remove_cv_t<T>> constexpr optional& operator=(U&& v);
|
| 84 |
```
|
| 85 |
|
| 86 |
+
*Constraints:*
|
| 87 |
+
|
| 88 |
+
- `is_same_v<remove_cvref_t<U>, optional>` is `false`,
|
| 89 |
+
- `conjunction_v<is_scalar<T>, is_same<T, decay_t<U>>>` is `false`,
|
| 90 |
+
- `is_constructible_v<T, U>` is `true`, and
|
| 91 |
+
- `is_assignable_v<T&, U>` is `true`.
|
| 92 |
|
| 93 |
*Effects:* If `*this` contains a value, assigns `std::forward<U>(v)` to
|
| 94 |
the contained value; otherwise direct-non-list-initializes the contained
|
| 95 |
value with `std::forward<U>(v)`.
|
| 96 |
|
|
|
|
| 160 |
|
| 161 |
**Table: `optional::operator=(optional<U>&&)` effects** <a id="optional.assign.move.templ">[optional.assign.move.templ]</a>
|
| 162 |
|
| 163 |
| | `*this` contains a value | `*this` does not contain a value |
|
| 164 |
| ------------------------------ | ------------------------------------------------------ | ---------------------------------------------------------------------- |
|
| 165 |
+
| `rhs` contains a value | assigns `*std::move(rhs)` to the contained value | direct-non-list-initializes the contained value with `*std::move(rhs)` |
|
| 166 |
| `rhs` does not contain a value | destroys the contained value by calling `val->T::~T()` | no effect |
|
| 167 |
|
| 168 |
|
| 169 |
*Ensures:* `rhs.has_value() == this->has_value()`.
|
| 170 |
|