Boost logo

Boost :

Subject: Re: [boost] Futures
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2015-01-05 06:19:01


On Monday, January 05, 2015 00:01:57 Mathias Gaunard wrote:
> On 04/01/2015 16:55, Sebastian Schaetz wrote:
> > Thomas Heller <thom.heller <at> gmail.com> writes:
> >> Interesting. Let me try to explain what I am seeing in the future concept
> >
> > first
> >
> >> and try to translate that async_result:
> >> For me, the concept behind futures is twofold, you have the future<T> on
> >> the *receiving* side which is, apart from the return type of the async
> >> operation, a completely type erased (as in type of asynchronous
> >> operation) handle to a future result. Things like promise, packaged_task
> >> or whatnot represent the *sending* side of the operation.
> >
> > I'm really happy about this discussion here. Can you clarify what you mean
> > by a future being type erased? You don't mean to say a future is a
> > future<any>, do you?
>
> Presumably that the type of the future does not contain the type of the
> callable function object it contains, thus requiring dynamic memory
> allocation and indirection.

Exactly. Very similar to what std::function does. Dynamic memory allocation
could be eliminated with small object optimization though.

>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


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