Fix bug in print list function

This commit is contained in:
nsubiron 2018-09-05 16:00:20 +02:00
parent 09f4ed7fd7
commit 179ab3eb9b
1 changed files with 7 additions and 4 deletions

View File

@ -14,10 +14,13 @@
template <typename Iterable>
static std::ostream &PrintList(std::ostream &out, const Iterable &list) {
auto it = list.begin();
out << '[' << *it;
for (++it; it != list.end(); ++it) {
out << ", " << *it;
out << '[';
if (!list.empty()) {
auto it = list.begin();
out << *it;
for (++it; it != list.end(); ++it) {
out << ", " << *it;
}
}
out << ']';
return out;