danvratil / qcoro

C++ Coroutines for Qt
https://qcoro.dvratil.cz
MIT License
326 stars 53 forks source link

Support for move only types in QFuture via takeResult #217

Closed fluttershydev closed 4 months ago

fluttershydev commented 4 months ago

Qt 6.0 added QFuture::takeResult which allows using move only types with futures, as long as you only get the result once. QCoroFuture uses result, which I believe is the correct default, but I would like a way to opt into using the move version.

As a hack I just took QCoroFuture and modified it a bit, and this works great. Maybe something like co_await QCoroFutureOnce(future) would work, or maybe co_await qCoro(future).moveable().