Skip to content

Instantly share code, notes, and snippets.

@jimdiroffii
Created November 18, 2023 20:13
Show Gist options
  • Save jimdiroffii/3f8a4d052a47048ddc4e6be8bf7b3860 to your computer and use it in GitHub Desktop.
Save jimdiroffii/3f8a4d052a47048ddc4e6be8bf7b3860 to your computer and use it in GitHub Desktop.
C++ :: Templated vector print function
// Credit: @bweinman | C++ Templates and the STL
// printv() iterates a vector, printing space separated elements
template<type T>
void printv(vector<T> &v) {
if(v.empty()) return;
for(T &i : v) cout << i << " ";
cout << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment