错误:静态断言失败:std::thread 参数在转换为右值后必须是可调用的

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)

为什么这不起作用?

Mih*_*Pop 7

调用线程构造函数时缺少初始整数值:thread(std::ref(tfunc), 123)。

线程体的函数需要整数,需要在线程启动时提供。