Created
May 21, 2014 12:18
-
-
Save termoose/b7b3e30ee649b7b4b762 to your computer and use it in GitHub Desktop.
c++ range
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
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