DebugWriter: Add std::vector print handler

This commit is contained in:
Jonas Kulla 2014-05-21 18:10:46 +02:00
parent 32bb18d93f
commit 2d30301aef
1 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <vector>
/* A cheap replacement for qDebug() */ /* A cheap replacement for qDebug() */
@ -44,6 +45,15 @@ public:
return *this; return *this;
} }
template<typename T>
Debug &operator<<(const std::vector<T> &v)
{
for (size_t i = 0; i < v.size(); ++i)
buf << v[i] << " ";
return *this;
}
~Debug() ~Debug()
{ {
std::clog << buf.str() << std::endl; std::clog << buf.str() << std::endl;