diff --git a/libs/utils/include/utils/ostream.h b/libs/utils/include/utils/ostream.h index de61c70c9f..d3aba2e436 100644 --- a/libs/utils/include/utils/ostream.h +++ b/libs/utils/include/utils/ostream.h @@ -130,10 +130,13 @@ private: template class VECTOR, typename T> inline ostream& operator<<(ostream& stream, const VECTOR& v) { stream << "< "; - for (size_t i = 0; i < v.size() - 1; i++) { - stream << v[i] << ", "; + if (v.size() > 0) { + for (size_t i = 0; i < v.size() - 1; i++) { + stream << v[i] << ", "; + } + stream << v[v.size() - 1]; } - stream << v[v.size() - 1] << " >"; + stream << " >"; return stream; }