Created
May 5, 2019 17:40
-
-
Save AndrewRademacher/64763480f1f67bc5589e0cf639b3ca4e to your computer and use it in GitHub Desktop.
testing for proximity to the end of an iterator.
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
#include <string> | |
#include <iostream> | |
#include <vector> | |
int main() { | |
std::vector<uint64_t> elems{1, 2, 3, 4, 5, 6}; | |
std::cout << "[ "; | |
for (auto itr = elems.begin(); itr != elems.end(); ++itr) { | |
std::cout << *itr; | |
if (itr + 1 != elems.end()) std::cout << ", "; | |
} | |
std::cout << " ]"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results in (written to console):