i am new to threading, i am trying to pass overloaded methods to std::thread like below example
#include <iostream>
#include <thread>
int do_calculation(int x)
{
std::cout<<x;
}
float do_calculation(float x)
{
std::cout<<x;
}
int main()
{
std::thread t1(do_calculation,20);
std::thread t2(do_calculation,200.0f);
return 0;
}
but the program is not compiling and throwing error that no matching function for call to 'std::thread::thread(<unresolved overloaded function type>, int)' std::thread t1(do_calculation,20);
Is there a way to call overloaded methods in thread?
Aucun commentaire:
Enregistrer un commentaire