Boost logo

Boost :

From: Johan Torp (johan.torp_at_[hidden])
Date: 2008-05-16 05:14:58


Frank Mori Hess wrote:
>
> I've just noticed that neither Anthony's or Braddock's future libraries
> seem
> to support construction of a future directly from a value, like
>
> future<int> fut_int(5);
>
> Adding such a constructor gives support for implicit conversion of a value
> of
> type T to a future<T>. So a function which takes futures as arguments can
> also seamlessly accept values:
>
> future<void> my_func(future<int> f1, future<int> f2);
>
> my_func(fut_int, 3);
>

Adding an explicit constructor is one thing. Allowing implicit type
conversions is more dangeous and needs to be thought through carefully.
Could you make do with explicit constructing?

my_func(fut_int, future<int>(3));

Johan

-- 
View this message in context: http://www.nabble.com/-future--direct-construct-from-value-tp17253307p17270617.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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