Created
May 5, 2019 17:46
-
-
Save AndrewRademacher/123d069285104df206f6a41a82dea1a4 to your computer and use it in GitHub Desktop.
testing generically for proximity to the end of a structure.
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> | |
#include <array> | |
template<typename T> | |
void printElemes(T elems) { | |
std::cout << "[ "; | |
for (auto itr = elems.begin(); itr != elems.end(); ++itr) { | |
std::cout << *itr; | |
if (itr + 1 != elems.end()) std::cout << ", "; | |
} | |
std::cout << " ]\n"; | |
} | |
int main() { | |
std::vector<uint64_t> vec{1, 2, 3, 4, 5, 6}; | |
printElemes(vec); | |
std::array<uint64_t, 5> ary{1, 2, 3, 4, 5}; | |
printElemes(ary); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment