Boost logo

Boost :

Subject: Re: [boost] Futures Review - Shouldpackaged_taskbeCopyConstructible?
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-02-11 04:44:03

----- Original Message -----
From: "Anthony Williams" <anthony.ajw_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, February 11, 2009 9:31 AM
Subject: Re: [boost] Futures Review - Shouldpackaged_taskbeCopyConstructible?

> "vicente.botet" <vicente.botet_at_[hidden]> writes:
>> Sorry i was not clear. The problem is that the reference to the task
>> std::packaged_task<result_type> task(std::move(f));
>> has been stored in the set_wait_callback. But this address is no more
>> valable when the function returns, so when the user gets the future
>> and call to get, the callback uses a bad address. Hoping it is clear
>> now.
> Yes, it's clear. That's a design issue with set_wait_callback.
>> Ok, I see. Anyway, I think that examples like
>> template<typename F>
>> std::packaged_task<typename std::result_of<F()>::type> lazy_call(F f);
>> should be included in the library, at least as an example.
> That's a good idea.

Have you an idea how to solve the design issue to implement lazy_call?
In, I requested the differences between a lazy future and a function pointer. Please could you answer to this post?


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