I'm kind of new to std::async and I have problems understanding how it works. I saw example of how to pass member funcion to std::async somewhere on the web but it seems not to compile. Whats the problem here? How can it be done without lambda?
class Test {
std::future<void> f;
void test() {}
void runTest() {
// ERROR no instance overloaded matches argument list
f = std::async(std::launch::async, &Test::test, this);
// OK...
f = std::async(std::launch::async, [this] {test();});
}
void testRes() {
f.get();
}
};
void Test::test()an overloaded member function?main()etc so it's a minimal reproducible example.