Skip to content

Instantly share code, notes, and snippets.

@heejune
Created February 19, 2017 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heejune/15bf812d220e6bfcea5278d71bc898ad to your computer and use it in GitHub Desktop.
Save heejune/15bf812d220e6bfcea5278d71bc898ad to your computer and use it in GitHub Desktop.
std::future coroutine
#include <future>
std::future<int> compute_value()
{
int result = co_await std::async([]
{
return 30;
});
co_return result;
}
int main()
{
compute_value().get();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment