Skip to content

Instantly share code, notes, and snippets.

@termoose
Created May 21, 2014 12:18
Show Gist options
  • Save termoose/b7b3e30ee649b7b4b762 to your computer and use it in GitHub Desktop.
Save termoose/b7b3e30ee649b7b4b762 to your computer and use it in GitHub Desktop.
c++ range
std::vector<int> range(int a, int b)
{
std::vector<int> result(b-a);
std::iota(std::begin(result), std::end(result), a);
return result;
}
for(int i : range(5, 10))
{
// Do stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment