I am trying to construct a std::thread
with a member function that takes no arguments and returns void
. I can’t figure out any syntax that works – the compiler complains no matter what. What is the correct way to implement spawn()
so that it returns a std::thread
that executes test()
?
#include <thread>
class blub {
void test() {
}
public:
std::thread spawn() {
return { test };
}
};