Hello,
I am trying to use boost::future with continuations, in particular
when_all/when_any.
I am using Boost trunk from GitHub (since only that has when_all etc).
This is what I want to compile:
===
#include <iostream>
#define BOOST_THREAD_PROVIDES_FUTURE
#define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
#define BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY
#include
using namespace boost;
int main() {
future<int> f1 = async([]() { return 1; });
future<int> f2 = async([]() { return 2; });
auto f3 = when_all(f1, f2);
f3.then([](decltype(f3)) {
std::cout << "done" << std::endl;
});
f3.get();
}
===
https://gist.github.com/oberstet/9783359
This bails out with
/usr/include/c++/v1/memory:1685:31: error: call to deleted constructor
of 'boost::future<int>'
https://gist.github.com/oberstet/9783364
Am I doing it wrong?
Thanks!
/Tobias