advent-of-code/2022/cpp/02/lib.hpp

19 lines
335 B
C++
Raw Permalink Normal View History

2023-08-02 11:50:10 +02:00
#include <ostream>
#include <vector>
template<class T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &list) {
unsigned long i = 0;
os << "[";
for (auto el : list) {
os << el;
if (i < list.size() - 1) {
os << ", ";
}
i++;
}
os << "]";
return os;
}