質問

I would like to implement a method like this:

boost::unique_future<int> foo()
{
    return defer([=] // call this lambda on boost::unique_future<int>::get();
    {
         return prime(10);
    });
}

I know of boost::promise and boost::packaged_task and set_wait_callback, however since the returned future takes a reference to either this will not work?

I know there is std::async and std::launch::sync, but how can emulate it using boost and vs2010?

std::unique_future<int> foo()
{
    return std::async(std::launch::sync, [=] 
    {
         return prime(10);
    });
}

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top