I know the question will be marked as duplicate, because I , too, have read couple of similar questions on SO. But unfortunately none of the answers worked for me. I tried all of 'em and as a last option I wanted to ask.
void AsyncClass::method1()
{
cout << "method is called" << endl;
}
void AsyncClass::method2()
{
auto t = new std::thread(this->method1);
}
Both of the methods are public and non-static. This doesn't compile saying
non-standard syntax; use '&' to create a pointer to member
Also considering the answers on SO I have tried
auto t = new std::thread(this->method1);
auto t = new std::thread(this->*method1);
auto t = new std::thread(&(this->method1));
auto t = new std::thread(&AsyncClass::method1);
None of them compiled. What is the correct way to to it?