Boost Users :
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2020-10-19 10:53:23
On 18/10/2020 22:55, Gavin Lambert via Boost-users wrote:
> On 17/10/2020 05:45, David Frank wrote:
>> Does boost promise/future support coroutines?
> Futures and coroutines aren't really a great fit together, since the
> former only has a blocking interface while the latter is intended to be
> used in an entirely non-blocking fashion.
The OP probably was asking if Boost's futures have the coroutines markup
to make them into C++ Coroutine awaitables, like std::future is in MSVC
>From a quick search of
answer is no. HOWEVER Boost.Thread's futures do implement .then(), and
via that the additional coroutine markup needed is trivially easy.
(In fact, someone ought to implement that markup if __cpp_coroutines
defined and submit it as a PR, because it's certainly very convenient,
albeit quite inefficient)
> If you're wanting to work with C++20 style coroutines, probably your
> best bet is to use a library such as CppCoro.Â While this doesn't have a
> "future" class per se, it does have the equivalent async version as
> "task", and it's possible to do sync waits or wrap it in a future if you
> do want to block a thread for some reason.
We've moved on from task<T> :)
We now have (probably) eager<T> and lazy<T>. Boost.Outcome has
implementations which work just fine with T's having nothing to do with
If the OP wants to resume coroutines on different kernel threads to
where they were suspended, then they'll need to use atomic_eager<T> and
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net