i'm just starting to learn coding and i have a problem right now... I searched on the forum for a similar one but i didnt find any...
I have class (Scheduler) and a template function in this class (function)
from the default constructor of this class i try to execute this function within a thread
im not sure i was very clear so i give you the lines :
the errors :
-static assertion failed: std::thread arguments must be invocable after conversion to rvalues
-error: no type named 'type' in 'struct std::thread::_Invoker<std::tuple<void (Scheduler::*)(int&, Temperature&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char), Scheduler*, int, Temperature, const char*, char> >::__result<std::tuple<void (Scheduler::*)(int&, Temperature&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char), Scheduler*, int, Temperature, const char*, char> >'
the function (which is in the public part of my class Scheduler) :
template<class T, class S>
void function(T& p_data,S& obj, const std::string p_file, char p_type)
{
for (int i = 0; i<10; i++){
Sleep(3500);
p_data = obj.getData();
serv.fileWrite(p_data, p_file, p_type);
serv.consoleWrite(m_Tmp, 'T');
serv.consoleWrite(m_Prs, 'P');
serv.consoleWrite(m_Hmy, 'H');
serv.consoleWrite(m_Light, 'L');
std::cout << "--------------------" << std::endl;
}
}
the thread (which is in the default constructor) :
thread t1(&Scheduler::function<int,Temperature>, this, m_Tmp, objTemperature, "Logs/Temperature.log", 'T');
Here it is ... I'm not seeing what i am doing wrong...