threadpool icon indicating copy to clipboard operation
threadpool copied to clipboard

关于 auto task = std::make_shared<std::packaged_task<ResType()>>(std::bind(std::forward<F>(f), std::forward<Args>(args)...) );

Open lizhuo111 opened this issue 3 years ago • 1 comments

有两个问题想请教:1.有没有别的写法 2.我使用的方法为:std::packaged_task<ResType()>task(forward<F>(f), std::forward<Args>(args)...) ); 就是没给makeshared 为什么会报错呢

lizhuo111 avatar Jul 13 '22 09:07 lizhuo111

什么错, 你的对象销毁了? makeshare 是制造引用

lzpong avatar Feb 08 '23 11:02 lzpong