In my C++ program I create two overloading function doSomething() and doSomething(int, int). My problem is that when I call async task by passing (async, doSomething, a, b) parameter the compiler gives "No Matching Function for call async" error. So guys how can I pass two arg doSomething(int, int) function under async task.
My Code:
void doSomething(){ // do some work}
void doSomething(int &a, int &b){ // do some work}
int main(){
int a = 34, b = 44;
auto f = std::async(std::launch::async, doSomething, std::ref(a), std::ref(b));
}
Aucun commentaire:
Enregistrer un commentaire