Skip to content

Instantly share code, notes, and snippets.

@milesrout
Last active May 29, 2016 05:22
Show Gist options
  • Save milesrout/03cf582506a8643db953 to your computer and use it in GitHub Desktop.
Save milesrout/03cf582506a8643db953 to your computer and use it in GitHub Desktop.
int successor(int x) {
return x + 1;
}
future<int> successor_async(int x) {
promise<decltype(x + 1)> p;
thread([] {
p.set_value(x + 1);
}).detach();
return p.get_future();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment