[Reviews] Futures - packaged_task and shared_future

Hi, 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. Best, Vicenre _____________________ Vicente Juan Botet Escribá

"vicente.botet" <vicente.botet@wanadoo.fr> 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 -- Anthony Williams Author of C++ Concurrency in Action | http://www.manning.com/williams Custom Software Development | http://www.justsoftwaresolutions.co.uk Just Software Solutions Ltd, Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK

----- Original Message ----- From: "Anthony Williams" <anthony.ajw@gmail.com> To: <boost@lists.boost.org> Sent: Monday, January 05, 2009 12:55 PM Subject: Re: [boost] [Reviews] Futures - packaged_task and shared_future
"vicente.botet" <vicente.botet@wanadoo.fr> writes:
can you consider the ability of a shared_packaged_task to return a shared_future?
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
Excelent. I like this integration. Vicente
participants (2)
-
Anthony Williams
-
vicente.botet