Boost logo

Boost :

Subject: Re: [boost] [Reviews] Futures - packaged_task and shared_future
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-01-05 06:55:00

"vicente.botet" <vicente.botet_at_[hidden]> writes:

> can you consider the ability of a shared_packaged_task to return a
> shared_future?
> This is a temporary use case until we have implementation of
> containers allowing movable_only object.
> unique_future<T> is movable_only and can not be stored on current
> containers as for example fusion::tuple.

You can move a unique_future<T> into a shared_future<T>, which can
then be stored in a container.

boost::packaged_task<int> pt(some_func);
boost::shared_future<int> f=pt.get_future(); // move-assign


Anthony Williams
Author of C++ Concurrency in Action |
Custom Software Development |
Just Software Solutions Ltd, Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK

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