
"Hartmut Kaiser" <hartmut.kaiser@gmail.com> writes:
I've updated my futures library to include wait_for_any() and wait_for_all().
The provided overloads allow either waiting on up to five futures known at compile time:
unique_future<int> f1; shared_future<std::string> f2; unique_future<double> f3; unsigned const ready_index=wait_for_any(future1,future2,future3);
or on a container of futures:
std::vector<jss::shared_future<int> > futures; std::vector<jss::shared_future<int> >::iterator const future= jss::wait_for_any(futures.begin(),futures.end());
In the first instance, they can be of distinct types, but in the latter, all the futures in the container must be of the same type.
The documentation is available at http://www.justsoftwaresolutions.co.uk/files/futures_documentation.html and the files and tests are available at http://www.justsoftwaresolutions.co.uk/files/n2561_futures_revised_2008 0530.zip
This reminds me of a discussion we had some time ago, namely overloading operator&&() for futures allowing to achieve the same thing: waiting for all of the futures:
Yes. I was trying to stay away from the overloaded operators, but this is certainly the same issue. Anthony -- Anthony Williams | Just Software Solutions Ltd Custom Software Development | http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL