Boost logo

Boost :

Subject: Re: [boost] Futures Review - wait_for_ on fusion sequences
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-01-17 09:44:57


Could the wait_for_ functions be overloaded for fusion sequences, e.g.

fusion::vector<shared_future<int>, shared_future<string> > seq;

unsigned i = wait_for_any(seq);

I have checkd the followig code and it works for me.

struct waiter_add {
    waiter_add(boost::detail::future_waiter& waiter) : waiter_(waiter) {}
    boost::detail::future_waiter& waiter_;
    template<typename ACT>
    void operator()(ACT& act) const {
template<typename FusionSequence>
unsigned wait_for_any(FusionSequence& seq) {
    boost::detail::future_waiter waiter;
    boost::fusion::for_each(seq, waiter_add(waiter));
    return waiter.wait();


Boost list run by bdawes at, gregod at, cpdaniel at, john at