[cpp-threads] Re: Thread API interface tweaks

Pete Becker petebecker at acm.org
Tue Aug 29 18:48:16 BST 2006


On Aug 29, 2006, at 1:25 PM, Herb Sutter wrote:

> Howard, what Nick says reminds me of other reasons for  
> future<void>. One is when you don't know or care about the value's  
> type but you do want to take a future:
>
>   future<void> f = SomeFnThatReturnsAFuture();
>
> where I don't necessarily know the type of the future but I also  
> don't really care (maybe I don't use it, or maybe I pass it on to  
> other code). So future<T> should be implicitly convertible to  
> future<void> if I'm not interested in the specific result -- again  
> I agree this is more compelling in designs where future has other  
> ops such as wait, is_ready, cancel, etc.
>
> Then there's future_group, where sometimes you want the type:
>
>   future<int> f1, f2;
>   ...
>   future_group<int> g1 = f1 || f2;
>   int i = g1();
>

This is, of course, library design by committee without pre-existing  
practice.


   -- Pete

Roundhouse Consulting, Ltd.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.decadentplace.org.uk/pipermail/cpp-threads/attachments/20060829/98676650/attachment.html


More information about the cpp-threads mailing list