std thread call template member function of template class: compiler error

后端 未结 2 426

Here is the code. It does not compile in vs2013, but does compile in gcc4.8

error C2665: \'std::thread::thread\' : none of the 4 overloads could convert all the argu

2条回答
  •  醉酒成梦
    2021-01-20 06:23

    You could simply use a lambda rather than monkeying with member function pointers:

    auto aaa = thread( [&]{ A.fun(1); } );
    aaa.join();
    

提交回复
热议问题