I have a threads manager class with the folloing methods:
template <class _Fn, class... _Args>
void create_thread (_Fn&& fun, _Args&&... args)
{
std::thread t (std::mem_fn(&MyClass::threads_entry<_Fn, _Args...>),
this, fun, args...);
}
template <class _Fn, class... _Args>
void threads_entry (_Fn&& fun, _Args&&... args)
{
fun (std::forward <_Args>(args)...);
perform_on_before_thread_exit_tasks();
}
In another class I'm trying to use it. This class has the following members:
void make_sure_thread_created ()
{
m_threads.create_thread (
&MyClass2::thread_tasks,
this);
}
void thread_tasks ()
{
}
I get compilation error (MS VC2013):
error: C2064: term does not evaluate to a function taking 1 arguments
It points to this line of code:
fun (std::forward <_Args>(args)...);
Am I doing something wrong? Or is it the compiler bug? What can be done here?...
Aucun commentaire:
Enregistrer un commentaire