Mih*_*Pop 12 c++ linux multithreading std
我正在尝试向 std::thread 添加一个 std::function 并且我偶然发现了这个错误
error: static assertion failed: std::thread arguments must be invocable after conversion to rvalues
Run Code Online (Sandbox Code Playgroud)
struct Foo {
explicit Foo(const std::function<void(int)>& tfunc)
: thread(tfunc) { //<----- error points here
thread.join();
}
std::thread thread;
}
Run Code Online (Sandbox Code Playgroud)
为什么这不起作用?
| 归档时间: |
|
| 查看次数: |
8898 次 |
| 最近记录: |