Created
December 16, 2017 15:02
-
-
Save espresso3389/c9fe85b6431187676c167a9bb942a609 to your computer and use it in GitHub Desktop.
Evaluating coroutine performance on Visual C++
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 <cstdio> | |
#include <random> | |
#include <experimental/generator> | |
auto random() | |
{ | |
std::mt19937 r; | |
for (;;) | |
co_yield r(); | |
} | |
int main() | |
{ | |
for (auto r : random()) | |
std::printf("%d\n", r); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment