#include <iostream>
#include <Windows.h>
#include <thread>
class Car
{
void operator()() const
{
for (int i = 0; i < 10; ++i)
{
std::cout << i << " Starting a car" << std::endl;
Sleep(1000);
}
}
};
void do_some_work()
{
for (int i = 0; i < 20; ++i)
{
std::cout << i << " pracuje" << std::endl;
Sleep(1000);
}
}
int main()
{
std::thread t1(do_some_work);
std::thread t2((Car()));
for (int i = 0; i < 15;++i)
{
std::cout << i << " Watek glowny" << std::endl;
Sleep(1000);
}
return 0;
}
Dlaczego program mi się nie kompiluje? Wywala mi błąd:
Failed to specialize function template 'unknown-type std::invoke(_Callable &&,_Types &&...)