Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <future>
- using namespace std;
- long factorial (int num) {
- long prod = 1;
- for (int i = 1; i <= num; ++i) {
- prod *= i;
- }
- return prod;
- }
- int main () {
- future <long> fut = async (factorial, 100000);
- fut.wait ();
- long ans = fut.get ();
- cout << ans << endl;
- cout << "Done\n";
- }
- Error:
- /data/data/com.n0n3m4.droidc/files/temp.c: In function 'int main()':
- /data/data/com.n0n3m4.droidc/files/temp.c:19:16: error: variable 'std::future<long int> fut' has initializer but incomplete type
- future <long> fut = async (factorial, 100000);
- ^
- compilation terminated due to -Wfatal-errors.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement