I have the following function:
template <class T>
void programManager(std::shared_ptr<BaseStrategy<T>> st,std::shared_ptr<SMDSSubscriber<T>> md){some code}
and it the callable function for std::thread
bac declare as:
std::shared_ptr<BaseStrategy<EZXOrderEventHandler>> bac = make_shared<BacStrategy<EZXOrderEventHandler>>
and md declare as:
std::shared_ptr<SMDSSubscriber<EZXOrderEventHandler>> dataMarket = make_shared<SMDSSubscriber<EZXOrderEventHandler>>();
std::thread t2(&programManager,bac,dataMarket);
and I'm getting the error:
error: no matching function for call to ‘std::thread::thread(, std::shared_ptr >&, std::shared_ptr >&)’ std::thread t2(&programManager,bac,dataMarket);
note: candidate: template std::thread::thread(_Callable&&, _Args&& ...) thread(_Callable&& __f, _Args&&... __args)
template argument deduction/substitution failed:
/home/yaodav/Desktop/git_repo/test/main.cpp:347:54: note: couldn't deduce template parameter ‘_Callable’
std::thread t2(&programManager,bac,dataMarket);
std::thread t2(programManager<EZXOrderEventHandler>,bac,dataMarket);
work? – Daniel Langr