Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A c++ template to print any iterable
#include <iterator>
#include <utility>
// see live example on
template<class Stream, class Vector, class Begin = decltype(std::begin(std::declval<Vector>()))>
inline Stream& operator<<(Stream& stream, const Vector& vect) {
const char* dlm = "";
for(const auto& i : vect) { stream << dlm << i; dlm = ", "; }
return stream;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.