I am experimenting with a C ++ 0x thread partially implemented in gcc 4.5, and I have a problem that I cannot understand. Let's take a look at this code
#include <future> #include <iostream> int main() { std::cout << std::async([]() { return 10; }).get() << std::endl; }
it is quite simple and should work, but it is not. It throws std :: system_error
ending the call after calling the instance of 'std :: system_error' which (): Canceled
what () returns an empty string, so there is no error information. Moreover, he did not work on an online compiler that also uses gcc 4.5, but now it works. You can see it here http://liveworkspace.org/code/f3003d62a758e047a880920c84f1241c but yesterday he chose the same exception (although there were no changes on the server). Do you know what the problem is?
Thank.
multithreading c ++ 11 g ++
confucius Oct. 14 '10 at 6:39 2010-10-14 06:39
source share