Async Programming
-
Future object is returned by the async function.
Promise is returned by async.
#include <iostream>
#include <thread>
#include <iostream>
#include <future>
void fun(){
std::cout << "Hello";
}
int main() {
auto fut = std::async (std::launch::async, fun);
}
$ ./a.out
Hello