tmp/tmp5h_pklfp/{from.md → to.md}
RENAMED
|
@@ -3,45 +3,45 @@
|
|
| 3 |
``` cpp
|
| 4 |
template<class F> constexpr auto and_then(F&& f) &;
|
| 5 |
template<class F> constexpr auto and_then(F&& f) const &;
|
| 6 |
```
|
| 7 |
|
| 8 |
-
Let `U` be `remove_cvref_t<invoke_result_t<F, decltype(
|
| 9 |
|
| 10 |
*Constraints:* `is_constructible_v<E, decltype(error())>` is `true`.
|
| 11 |
|
| 12 |
*Mandates:* `U` is a specialization of `expected` and
|
| 13 |
-
`is_same_v<U::error_type, E>` is `true`.
|
| 14 |
|
| 15 |
*Effects:* Equivalent to:
|
| 16 |
|
| 17 |
``` cpp
|
| 18 |
if (has_value())
|
| 19 |
-
return invoke(std::forward<F>(f),
|
| 20 |
else
|
| 21 |
return U(unexpect, error());
|
| 22 |
```
|
| 23 |
|
| 24 |
``` cpp
|
| 25 |
template<class F> constexpr auto and_then(F&& f) &&;
|
| 26 |
template<class F> constexpr auto and_then(F&& f) const &&;
|
| 27 |
```
|
| 28 |
|
| 29 |
Let `U` be
|
| 30 |
-
`remove_cvref_t<invoke_result_t<F, decltype(std::move(
|
| 31 |
|
| 32 |
*Constraints:* `is_constructible_v<E, decltype(std::move(error()))>` is
|
| 33 |
`true`.
|
| 34 |
|
| 35 |
*Mandates:* `U` is a specialization of `expected` and
|
| 36 |
-
`is_same_v<U::error_type, E>` is `true`.
|
| 37 |
|
| 38 |
*Effects:* Equivalent to:
|
| 39 |
|
| 40 |
``` cpp
|
| 41 |
if (has_value())
|
| 42 |
-
return invoke(std::forward<F>(f), std::move(
|
| 43 |
else
|
| 44 |
return U(unexpect, std::move(error()));
|
| 45 |
```
|
| 46 |
|
| 47 |
``` cpp
|
|
@@ -49,20 +49,20 @@ template<class F> constexpr auto or_else(F&& f) &;
|
|
| 49 |
template<class F> constexpr auto or_else(F&& f) const &;
|
| 50 |
```
|
| 51 |
|
| 52 |
Let `G` be `remove_cvref_t<invoke_result_t<F, decltype(error())>>`.
|
| 53 |
|
| 54 |
-
*Constraints:* `is_constructible_v<T, decltype(
|
| 55 |
|
| 56 |
*Mandates:* `G` is a specialization of `expected` and
|
| 57 |
-
`is_same_v<G::value_type, T>` is `true`.
|
| 58 |
|
| 59 |
*Effects:* Equivalent to:
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
if (has_value())
|
| 63 |
-
return G(in_place,
|
| 64 |
else
|
| 65 |
return invoke(std::forward<F>(f), error());
|
| 66 |
```
|
| 67 |
|
| 68 |
``` cpp
|
|
@@ -71,39 +71,39 @@ template<class F> constexpr auto or_else(F&& f) const &&;
|
|
| 71 |
```
|
| 72 |
|
| 73 |
Let `G` be
|
| 74 |
`remove_cvref_t<invoke_result_t<F, decltype(std::move(error()))>>`.
|
| 75 |
|
| 76 |
-
*Constraints:* `is_constructible_v<T, decltype(std::move(
|
| 77 |
-
`true`.
|
| 78 |
|
| 79 |
*Mandates:* `G` is a specialization of `expected` and
|
| 80 |
-
`is_same_v<G::value_type, T>` is `true`.
|
| 81 |
|
| 82 |
*Effects:* Equivalent to:
|
| 83 |
|
| 84 |
``` cpp
|
| 85 |
if (has_value())
|
| 86 |
-
return G(in_place, std::move(
|
| 87 |
else
|
| 88 |
return invoke(std::forward<F>(f), std::move(error()));
|
| 89 |
```
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
template<class F> constexpr auto transform(F&& f) &;
|
| 93 |
template<class F> constexpr auto transform(F&& f) const &;
|
| 94 |
```
|
| 95 |
|
| 96 |
-
Let `U` be `remove_cv_t<invoke_result_t<F, decltype(
|
| 97 |
|
| 98 |
*Constraints:* `is_constructible_v<E, decltype(error())>` is `true`.
|
| 99 |
|
| 100 |
*Mandates:* `U` is a valid value type for `expected`. If `is_void_v<U>`
|
| 101 |
is `false`, the declaration
|
| 102 |
|
| 103 |
``` cpp
|
| 104 |
-
U u(invoke(std::forward<F>(f),
|
| 105 |
```
|
| 106 |
|
| 107 |
is well-formed.
|
| 108 |
|
| 109 |
*Effects:*
|
|
@@ -111,53 +111,54 @@ is well-formed.
|
|
| 111 |
- If `has_value()` is `false`, returns
|
| 112 |
`expected<U, E>(unexpect, error())`.
|
| 113 |
- Otherwise, if `is_void_v<U>` is `false`, returns an `expected<U, E>`
|
| 114 |
object whose *has_val* member is `true` and *val* member is
|
| 115 |
direct-non-list-initialized with
|
| 116 |
-
`invoke(std::forward<F>(f),
|
| 117 |
-
- Otherwise, evaluates `invoke(std::forward<F>(f),
|
| 118 |
returns `expected<U, E>()`.
|
| 119 |
|
| 120 |
``` cpp
|
| 121 |
template<class F> constexpr auto transform(F&& f) &&;
|
| 122 |
template<class F> constexpr auto transform(F&& f) const &&;
|
| 123 |
```
|
| 124 |
|
| 125 |
Let `U` be
|
| 126 |
-
`remove_cv_t<invoke_result_t<F, decltype(std::move(
|
| 127 |
|
| 128 |
*Constraints:* `is_constructible_v<E, decltype(std::move(error()))>` is
|
| 129 |
`true`.
|
| 130 |
|
| 131 |
*Mandates:* `U` is a valid value type for `expected`. If `is_void_v<U>`
|
| 132 |
is `false`, the declaration
|
| 133 |
|
| 134 |
``` cpp
|
| 135 |
-
U u(invoke(std::forward<F>(f), std::move(
|
| 136 |
```
|
| 137 |
|
| 138 |
-
is well-formed
|
| 139 |
|
| 140 |
*Effects:*
|
| 141 |
|
| 142 |
- If `has_value()` is `false`, returns
|
| 143 |
`expected<U, E>(unexpect, std::move(error()))`.
|
| 144 |
- Otherwise, if `is_void_v<U>` is `false`, returns an `expected<U, E>`
|
| 145 |
object whose *has_val* member is `true` and *val* member is
|
| 146 |
direct-non-list-initialized with
|
| 147 |
-
`invoke(std::forward<F>(f), std::move(
|
| 148 |
-
- Otherwise, evaluates
|
| 149 |
-
|
|
|
|
| 150 |
|
| 151 |
``` cpp
|
| 152 |
template<class F> constexpr auto transform_error(F&& f) &;
|
| 153 |
template<class F> constexpr auto transform_error(F&& f) const &;
|
| 154 |
```
|
| 155 |
|
| 156 |
Let `G` be `remove_cv_t<invoke_result_t<F, decltype(error())>>`.
|
| 157 |
|
| 158 |
-
*Constraints:* `is_constructible_v<T, decltype(
|
| 159 |
|
| 160 |
*Mandates:* `G` is a valid template argument for `unexpected`
|
| 161 |
[[expected.un.general]] and the declaration
|
| 162 |
|
| 163 |
``` cpp
|
|
@@ -165,11 +166,11 @@ G g(invoke(std::forward<F>(f), error()));
|
|
| 165 |
```
|
| 166 |
|
| 167 |
is well-formed.
|
| 168 |
|
| 169 |
*Returns:* If `has_value()` is `true`,
|
| 170 |
-
`expected<T, G>(in_place,
|
| 171 |
object whose *has_val* member is `false` and *unex* member is
|
| 172 |
direct-non-list-initialized with `invoke(std::forward<F>(f), error())`.
|
| 173 |
|
| 174 |
``` cpp
|
| 175 |
template<class F> constexpr auto transform_error(F&& f) &&;
|
|
@@ -177,12 +178,12 @@ template<class F> constexpr auto transform_error(F&& f) const &&;
|
|
| 177 |
```
|
| 178 |
|
| 179 |
Let `G` be
|
| 180 |
`remove_cv_t<invoke_result_t<F, decltype(std::move(error()))>>`.
|
| 181 |
|
| 182 |
-
*Constraints:* `is_constructible_v<T, decltype(std::move(
|
| 183 |
-
`true`.
|
| 184 |
|
| 185 |
*Mandates:* `G` is a valid template argument for `unexpected`
|
| 186 |
[[expected.un.general]] and the declaration
|
| 187 |
|
| 188 |
``` cpp
|
|
@@ -190,10 +191,10 @@ G g(invoke(std::forward<F>(f), std::move(error())));
|
|
| 190 |
```
|
| 191 |
|
| 192 |
is well-formed.
|
| 193 |
|
| 194 |
*Returns:* If `has_value()` is `true`,
|
| 195 |
-
`expected<T, G>(in_place, std::move(
|
| 196 |
`expected<T, G>` object whose *has_val* member is `false` and *unex*
|
| 197 |
member is direct-non-list-initialized with
|
| 198 |
`invoke(std::forward<F>(f), std::move(error()))`.
|
| 199 |
|
|
|
|
| 3 |
``` cpp
|
| 4 |
template<class F> constexpr auto and_then(F&& f) &;
|
| 5 |
template<class F> constexpr auto and_then(F&& f) const &;
|
| 6 |
```
|
| 7 |
|
| 8 |
+
Let `U` be `remove_cvref_t<invoke_result_t<F, decltype((`*`val`*`))>>`.
|
| 9 |
|
| 10 |
*Constraints:* `is_constructible_v<E, decltype(error())>` is `true`.
|
| 11 |
|
| 12 |
*Mandates:* `U` is a specialization of `expected` and
|
| 13 |
+
`is_same_v<typename U::error_type, E>` is `true`.
|
| 14 |
|
| 15 |
*Effects:* Equivalent to:
|
| 16 |
|
| 17 |
``` cpp
|
| 18 |
if (has_value())
|
| 19 |
+
return invoke(std::forward<F>(f), val);
|
| 20 |
else
|
| 21 |
return U(unexpect, error());
|
| 22 |
```
|
| 23 |
|
| 24 |
``` cpp
|
| 25 |
template<class F> constexpr auto and_then(F&& f) &&;
|
| 26 |
template<class F> constexpr auto and_then(F&& f) const &&;
|
| 27 |
```
|
| 28 |
|
| 29 |
Let `U` be
|
| 30 |
+
`remove_cvref_t<invoke_result_t<F, decltype(std::move(`*`val`*`))>>`.
|
| 31 |
|
| 32 |
*Constraints:* `is_constructible_v<E, decltype(std::move(error()))>` is
|
| 33 |
`true`.
|
| 34 |
|
| 35 |
*Mandates:* `U` is a specialization of `expected` and
|
| 36 |
+
`is_same_v<typename U::error_type, E>` is `true`.
|
| 37 |
|
| 38 |
*Effects:* Equivalent to:
|
| 39 |
|
| 40 |
``` cpp
|
| 41 |
if (has_value())
|
| 42 |
+
return invoke(std::forward<F>(f), std::move(val));
|
| 43 |
else
|
| 44 |
return U(unexpect, std::move(error()));
|
| 45 |
```
|
| 46 |
|
| 47 |
``` cpp
|
|
|
|
| 49 |
template<class F> constexpr auto or_else(F&& f) const &;
|
| 50 |
```
|
| 51 |
|
| 52 |
Let `G` be `remove_cvref_t<invoke_result_t<F, decltype(error())>>`.
|
| 53 |
|
| 54 |
+
*Constraints:* `is_constructible_v<T, decltype((`*`val`*`))>` is `true`.
|
| 55 |
|
| 56 |
*Mandates:* `G` is a specialization of `expected` and
|
| 57 |
+
`is_same_v<typename G::value_type, T>` is `true`.
|
| 58 |
|
| 59 |
*Effects:* Equivalent to:
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
if (has_value())
|
| 63 |
+
return G(in_place, val);
|
| 64 |
else
|
| 65 |
return invoke(std::forward<F>(f), error());
|
| 66 |
```
|
| 67 |
|
| 68 |
``` cpp
|
|
|
|
| 71 |
```
|
| 72 |
|
| 73 |
Let `G` be
|
| 74 |
`remove_cvref_t<invoke_result_t<F, decltype(std::move(error()))>>`.
|
| 75 |
|
| 76 |
+
*Constraints:* `is_constructible_v<T, decltype(std::move(`*`val`*`))>`
|
| 77 |
+
is `true`.
|
| 78 |
|
| 79 |
*Mandates:* `G` is a specialization of `expected` and
|
| 80 |
+
`is_same_v<typename G::value_type, T>` is `true`.
|
| 81 |
|
| 82 |
*Effects:* Equivalent to:
|
| 83 |
|
| 84 |
``` cpp
|
| 85 |
if (has_value())
|
| 86 |
+
return G(in_place, std::move(val));
|
| 87 |
else
|
| 88 |
return invoke(std::forward<F>(f), std::move(error()));
|
| 89 |
```
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
template<class F> constexpr auto transform(F&& f) &;
|
| 93 |
template<class F> constexpr auto transform(F&& f) const &;
|
| 94 |
```
|
| 95 |
|
| 96 |
+
Let `U` be `remove_cv_t<invoke_result_t<F, decltype((`*`val`*`))>>`.
|
| 97 |
|
| 98 |
*Constraints:* `is_constructible_v<E, decltype(error())>` is `true`.
|
| 99 |
|
| 100 |
*Mandates:* `U` is a valid value type for `expected`. If `is_void_v<U>`
|
| 101 |
is `false`, the declaration
|
| 102 |
|
| 103 |
``` cpp
|
| 104 |
+
U u(invoke(std::forward<F>(f), val));
|
| 105 |
```
|
| 106 |
|
| 107 |
is well-formed.
|
| 108 |
|
| 109 |
*Effects:*
|
|
|
|
| 111 |
- If `has_value()` is `false`, returns
|
| 112 |
`expected<U, E>(unexpect, error())`.
|
| 113 |
- Otherwise, if `is_void_v<U>` is `false`, returns an `expected<U, E>`
|
| 114 |
object whose *has_val* member is `true` and *val* member is
|
| 115 |
direct-non-list-initialized with
|
| 116 |
+
`invoke(std::forward<F>(f), `*`val`*`)`.
|
| 117 |
+
- Otherwise, evaluates `invoke(std::forward<F>(f), `*`val`*`)` and then
|
| 118 |
returns `expected<U, E>()`.
|
| 119 |
|
| 120 |
``` cpp
|
| 121 |
template<class F> constexpr auto transform(F&& f) &&;
|
| 122 |
template<class F> constexpr auto transform(F&& f) const &&;
|
| 123 |
```
|
| 124 |
|
| 125 |
Let `U` be
|
| 126 |
+
`remove_cv_t<invoke_result_t<F, decltype(std::move(`*`val`*`))>>`.
|
| 127 |
|
| 128 |
*Constraints:* `is_constructible_v<E, decltype(std::move(error()))>` is
|
| 129 |
`true`.
|
| 130 |
|
| 131 |
*Mandates:* `U` is a valid value type for `expected`. If `is_void_v<U>`
|
| 132 |
is `false`, the declaration
|
| 133 |
|
| 134 |
``` cpp
|
| 135 |
+
U u(invoke(std::forward<F>(f), std::move(val)));
|
| 136 |
```
|
| 137 |
|
| 138 |
+
is well-formed.
|
| 139 |
|
| 140 |
*Effects:*
|
| 141 |
|
| 142 |
- If `has_value()` is `false`, returns
|
| 143 |
`expected<U, E>(unexpect, std::move(error()))`.
|
| 144 |
- Otherwise, if `is_void_v<U>` is `false`, returns an `expected<U, E>`
|
| 145 |
object whose *has_val* member is `true` and *val* member is
|
| 146 |
direct-non-list-initialized with
|
| 147 |
+
`invoke(std::forward<F>(f), std::move(`*`val`*`))`.
|
| 148 |
+
- Otherwise, evaluates
|
| 149 |
+
`invoke(std::forward<F>(f), std::move(`*`val`*`))` and then returns
|
| 150 |
+
`expected<U, E>()`.
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
template<class F> constexpr auto transform_error(F&& f) &;
|
| 154 |
template<class F> constexpr auto transform_error(F&& f) const &;
|
| 155 |
```
|
| 156 |
|
| 157 |
Let `G` be `remove_cv_t<invoke_result_t<F, decltype(error())>>`.
|
| 158 |
|
| 159 |
+
*Constraints:* `is_constructible_v<T, decltype((`*`val`*`))>` is `true`.
|
| 160 |
|
| 161 |
*Mandates:* `G` is a valid template argument for `unexpected`
|
| 162 |
[[expected.un.general]] and the declaration
|
| 163 |
|
| 164 |
``` cpp
|
|
|
|
| 166 |
```
|
| 167 |
|
| 168 |
is well-formed.
|
| 169 |
|
| 170 |
*Returns:* If `has_value()` is `true`,
|
| 171 |
+
`expected<T, G>(in_place, `*`val`*`)`; otherwise, an `expected<T, G>`
|
| 172 |
object whose *has_val* member is `false` and *unex* member is
|
| 173 |
direct-non-list-initialized with `invoke(std::forward<F>(f), error())`.
|
| 174 |
|
| 175 |
``` cpp
|
| 176 |
template<class F> constexpr auto transform_error(F&& f) &&;
|
|
|
|
| 178 |
```
|
| 179 |
|
| 180 |
Let `G` be
|
| 181 |
`remove_cv_t<invoke_result_t<F, decltype(std::move(error()))>>`.
|
| 182 |
|
| 183 |
+
*Constraints:* `is_constructible_v<T, decltype(std::move(`*`val`*`))>`
|
| 184 |
+
is `true`.
|
| 185 |
|
| 186 |
*Mandates:* `G` is a valid template argument for `unexpected`
|
| 187 |
[[expected.un.general]] and the declaration
|
| 188 |
|
| 189 |
``` cpp
|
|
|
|
| 191 |
```
|
| 192 |
|
| 193 |
is well-formed.
|
| 194 |
|
| 195 |
*Returns:* If `has_value()` is `true`,
|
| 196 |
+
`expected<T, G>(in_place, std::move(`*`val`*`))`; otherwise, an
|
| 197 |
`expected<T, G>` object whose *has_val* member is `false` and *unex*
|
| 198 |
member is direct-non-list-initialized with
|
| 199 |
`invoke(std::forward<F>(f), std::move(error()))`.
|
| 200 |
|