Commit db63962
committed
st: P13 - rvalue overloads for Expected monadic ops and value_or
value_or, and_then, transform, and or_else were const&-only: they copied the
contained value into the continuation, and value_or/and_then/transform would
not even compile for a move-only T. Add &&-qualified overloads that move the
contained value (and forward the error by move), so a move-only or
expensive-to-copy T flows through the chain without a copy. value() and
operator* already had ref-qualified overloads. Verified at runtime with a
move-only payload (unique_ptr) on clang and gcc, plus an lvalue regression
pass.
Signed-off-by: Matteo Merli <mmerli@apache.org>1 parent 9999a4a commit db63962
1 file changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
187 | 193 | | |
188 | 194 | | |
189 | 195 | | |
| |||
202 | 208 | | |
203 | 209 | | |
204 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
205 | 218 | | |
206 | 219 | | |
207 | 220 | | |
| |||
219 | 232 | | |
220 | 233 | | |
221 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
222 | 243 | | |
223 | 244 | | |
224 | 245 | | |
| |||
235 | 256 | | |
236 | 257 | | |
237 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
238 | 266 | | |
239 | 267 | | |
240 | 268 | | |
| |||
0 commit comments