I want to print out the contents of a vector in C++, here is what I have:
#include #include #include #include
overload operator<<:
template OutStream& operator<< (OutStream& out, const vector& v) { for (auto const& tmp : v) out << tmp << " "; out << endl; return out; }
Usage:
vector test {1,2,3}; wcout << test; // or any output stream