thread construction function does not support function overloading

//thread construction function does not support function overloading
//it is so unfriendly
#include <thread>
#include <iostream>
class A
{
public:
void fun(){}
void fun(int,int,int,int){}
};
void g_fun(){}
void g_fun(int,int,int,int){}
int main()
{
std::thread t1(&A::fun,new A(),0,0,0,0);//error
std::thread t2(g_fun,0,0,0,0);//error
return 0;
}
Disambiguate.

1
2
3
4
5
6
7
8
int main()
{
    void(A::*mem_func)(int, int, int, int) = &A::fun;
    std::thread t1(mem_func, new A(), 0, 0, 0, 0);

    void(*g_func)(int, int, int, int) = g_fun;
    std::thread t2(g_func, 0, 0, 0, 0);
}


A cast would also serve.
thanks!
BR!
Topic archived. No new replies allowed.