I have this code.
int TA11::AsyncRunP(Unit *unit,Function func)
{
return 0;
}
int TA11::AsyncRunR(Unit& unit, Function func)
{
return 0;
}
void TA11::RunFunc(Unit& unit, Function func)
{
assert(!unit.fut_.valid());
unit.fut_ = std::async(std::launch::async, &TA11::AsyncRunR, this, unit, func);
unit.fut_ = std::async(std::launch::async, &TA11::AsyncRunP, this, &unit, func);
}
VS2019 c++17 mode. (Function is a class enum)
the first std::async wont compile, second one is fine.
1>C:\work\pdp\mysim\mysim\Ta11Cassette.cpp(115,19): error C2672: 'std::async': no matching overloaded function found 1>C:\work\pdp\mysim\mysim\Ta11Cassette.cpp(115,79): error C2893: Failed to specialize function template 'std::future<_Invoke_traits<void,decay<_Ty>::type,decay<_ArgTypes>::type...>::type> std::async(std::launch,_Fty &&,_ArgTypes &&...)' 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\future(1481): message : see declaration of 'std::async' 1>C:\work\pdp\mysim\mysim\Ta11Cassette.cpp(115,79): message : With the following template arguments: 1>C:\work\pdp\mysim\mysim\Ta11Cassette.cpp(115,79): message : '_Fty=int (__thiscall TA11::* )(TA11::Unit &,TA11::Function)' 1>C:\work\pdp\mysim\mysim\Ta11Cassette.cpp(115,79): message : '_ArgTypes={TA11 *, TA11::Unit &, TA11::Function &}'