I code snipped below:
#include <iostream>
#include <thread>
class Me{
public:
bool isLearning;
void operator()(bool startLearning){
isLearning = startLearning;
}
};
int main(){
Me m;
std::thread t1(m(true));
t1.join();
std::cout << m.isLearning << std::endl;
}
I can't start thread with callable object when argument is passed, is there any way to start thread and pass callable object with argument in thread constructor?