utils: small_vector: add print operator for std::ostream
In order to replace std::vector with utils::small_vector, it needs to support this feature too.
This commit is contained in:
@@ -468,4 +468,19 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, size_t N>
|
||||
std::ostream& operator<<(std::ostream& os, const utils::small_vector<T, N>& v) {
|
||||
os << "{";
|
||||
bool first = true;
|
||||
for (auto&& e : v) {
|
||||
if (!first) {
|
||||
os << ", ";
|
||||
}
|
||||
first = false;
|
||||
os << e;
|
||||
}
|
||||
os << "}";
|
||||
return os;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user