|
Boost Users : |
Subject: Re: [Boost-users] [boost::asio] Wait for multiple async_read()'s
From: Chris Glover (c.d.glover_at_[hidden])
Date: 2017-01-28 12:09:16
On Thu, 26 Jan 2017 at 22:41 Adam Zegelin <adam_at_[hidden]> wrote:
> Next problem :)
>
> asio's use_future returns a std::future. when_all() expects boost::futures.
> I can't find an obvious way to convert between the two and/or get
> asio's use_future to return a boost::future.
>
>
ASIO is set up to solve this -- you can write use_boost_future in the same
way that asio::use_future is written, but make it return a boost::future
instead.
You should be able to copy and paste the ASIO implementation of use_future,
and change the details to use boost::future instead.
A similar example can be found here, which adapts a custom future
implementation into Chris' std::executors reference implementation. This is
same author as ASIO and so it uses a similar technique. The code may even
work as is with just a change of the namespace from std::experimental to
boost::asio.
https://github.com/cdglove/daily-future/blob/master/include/daily/future/use_future.hpp
Good Luck!
-- chris
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