Hi All,
Below is a simple program in c++0x that makes use of packaged_task and futures. while compiling the program i get error : variable 'std::packaged_task pt1' has initializer but incomplete type
the program is below
#include <future>
#include <iostream>
using namespace std;
int printFn()
{
for(int i = 0; i < 100; i++)
{
cout << "thread " << i << endl;
}
return 1;
}
int main()
{
packaged_task<int> pt1(&printFn);
future<int> fut = pt1.get_future();
thread t(move(pt1));
t.detach();
int value = fut.get();
return 0;
}