async 0.2.2 released
[23rd September 2007]
In async 0.2.1, I added the ability to turn a future<> in to a future_scope allowing future<>s instantiated with different template parameters to be added to a single homogeneous container:
std::vector<async::future_scope> futs;
async::future<double> fd = async::call(cage, &func1, x, y, z);
async::future<std::string> fs = async::call(cage, &func2, a, b, c);
futs.push_back(fd.extend_lifetime());
futs.push_back(fs.extend_lifetime());
This is all well and good, but there was no way to get back to a future<> from a future_scope. Instead you had to resort to using Boost.Any, or something similar. In 0.2.2 this has changed.
There is now a future_cast<> function that allows you to get back to the future[1].
futs.push_back(fd.extend_lifetime());
futs.push_back(fs.extend_lifetime());
async::future<double> fd2 = async::future_cast<double>(futs[0]);
async::future<std::string> fs2 = async::future_cast<std::string>(futs[1]);
To find out more, head on over to the async project page.
Footnotes
- it's shameful how long it took me to work in that phrase with all my recent posts on futures [↵]
Comments
All original content copyright© Edd Dawson.
All source code appearing on this website that was written by Edd Dawson is made available under the terms of the Boost software license version 1.0 unless otherwise stated or implied by the license associated with the work from which the code is derived.
