Menu

QFuture ❤️ C++ coroutines | arno's blog
📰

QFuture ❤️ C++ coroutines | arno's blog

Planet Qt·8 months ago
#5j4hg7Ow
#planetqt#arnorehn#include#qfuture#co_await
Long article (603 words) — no AI summary yet.
Reading 0:00
15s threshold

Ever since C++20 introduced coroutine support, I was wondering how this could integrate with Qt. Apparently I wasn’t the only one: before long, QCoro popped up. A really cool library! But it doesn’t use the existing future and promise types in Qt; instead it introduces its own types and mechanisms to support coroutines. I kept wondering why no-one just made QFuture and QPromise compatible – it would certainly be a more lightweight wrapper then.

With a recent project at work being a gargantuan mess of QFuture::then() continuations (ever tried async looping constructs with continuations only? 🥴) I had enough of a reason to finally sit down and implement this myself.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.