
On Thu, Jun 27, 2013 at 9:01 PM, Vicente J. Botet Escriba < vicente.botet@wanadoo.fr> wrote:
I guess you need to call fut.then() before the value is set. I will need to check if this works when the future is not created with async().
::then<
>' : not all control
If the callback isn't called when set using then() if the value is already
acquired, I don't see the point of then().
Between the time you retrieve a future from any function returning it and
the time you call then(), the value could have been set.
So I expect ft.then( task ) to call immediately task if the value have
already been set.
Or maybe I didn't understood correctly what you meant?
On a related topic: I just upgraded to the latest SVN and forced Boost to
use decltype as result_of, which fixed a problem already mentionned.
Just in case it is not already known:
1.
ft.then( []( future<T> f ) { return 42; } );
This will not compile (VS2012U3) because there is an attempt to copy
future<T> (which looks like a bug I reported where returning a future would
trigger copy instead of moving the future, bug fixed since then so I'm a
bit surprise about this one)
2.
ft.then( []( future<T>& f ) { return 42; } );
This trigger the following warning:
1>e:\projects\sdk\boost\boost\include\boost-1_54\boost\thread\future.hpp(3956):
warning C4715: 'boost::future