Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created April 18, 2017 10:24
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 deque-blog/c6b0ef182797b90dc29640af4df1f224 to your computer and use it in GitHub Desktop.
Save deque-blog/c6b0ef182797b90dc29640af4df1f224 to your computer and use it in GitHub Desktop.
// Square number generator
auto square_gen =
transform_gen([](int i) { return i * i; }, int_gen(0, 10));
// Testing in std::cout
for (int i = 0; i < 10; ++i)
std::cout << square_gen(bit_gen) << ",";
std::cout << '\n';
// Outputs:
// 64,36,9,16,81,0,100,64,64,25,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment