Skip to content

Instantly share code, notes, and snippets.

@fabiogaluppo
Created November 5, 2015 23:08
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 fabiogaluppo/e288286749a6bb58b06b to your computer and use it in GitHub Desktop.
Save fabiogaluppo/e288286749a6bb58b06b to your computer and use it in GitHub Desktop.
std::iota(xs.begin(), xs.end(), 1); //xs = 1 2 3 4 5 6 7 8 9 10
std::iota(xs.begin(), xs.end(), 10); //xs = 10 11 12 13 14 15 16 17 18 19
std::fill(xs.begin(), xs.end(), 0);
std::iota(xs.begin(), xs.begin() + xs.size() / 2, 1); //xs = 1 2 3 4 5 0 0 0 0 0
std::iota(xs.rbegin(), xs.rend(), 0); //xs = 9 8 7 6 5 4 3 2 1 0
std::iota(xs.rbegin(), xs.rend(), 100); //xs = 109 108 107 106 105 104 103 102 101 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment