Created
February 19, 2017 17:00
-
-
Save heejune/15bf812d220e6bfcea5278d71bc898ad to your computer and use it in GitHub Desktop.
std::future coroutine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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