Skip to content

Instantly share code, notes, and snippets.

@espresso3389
Created December 16, 2017 15:02
Show Gist options
  • Save espresso3389/c9fe85b6431187676c167a9bb942a609 to your computer and use it in GitHub Desktop.
Save espresso3389/c9fe85b6431187676c167a9bb942a609 to your computer and use it in GitHub Desktop.
Evaluating coroutine performance on Visual C++
#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