Boost logo

Boost :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2007-03-14 16:45:38


 
Braddock Gaskill wrote:

> > Instead of going with generalized future composition, I've
> tried the
> > route of
> > 'wait_all(<future-list>) ' and 'wait_any(<future-tuple>)'
>
> This is exactly what I personally would like to see. I don't
> relish the thought of digging out a return type or exception
> from a future<variant<float, string, tuple<int, double, bool>
> > >. I would just want something that wakes me up when
> dinner is ready and let me figure out which of my futures are
> valid or have failed, if I even care.

You don't need to use the return type, if you don't want to use it
afterwards. And in the case you're interested in the actula return value, a
function like above will have to return the variant<float, string,
tuple<int, double, bool> > as well. So what do you gain from using a
function? Operator overloading gives you variable future counts with far
less coding effort. With functions you have to spell out a specialization
for every possible number of futures you want to combine.

> wait(f1 || (f2 && f3));
> might be nice syntax, does actually add functionality, and is
> simple enough as well.

Yeah, sure. The library in the vault has a futurize() function doing exactly
what you want, just pass a arbitrary complex future expression to it. No
need to know the returned data type.

Regards Hartmut


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk