Add << operators for vectors & sets in tests
This commit is contained in:
parent
0675585a53
commit
aae4fa238f
1 changed files with 33 additions and 0 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <set>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <typeindex>
|
#include <typeindex>
|
||||||
|
|
||||||
|
|
@ -40,6 +41,38 @@ std::ostream & operator << (std::ostream & s, std::tuple<Ts...> const & t)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
std::ostream & operator << (std::ostream & s, std::vector<T> const & v)
|
||||||
|
{
|
||||||
|
s << "[";
|
||||||
|
bool first = true;
|
||||||
|
for (auto const & x : v)
|
||||||
|
{
|
||||||
|
if (!first)
|
||||||
|
s << ", ";
|
||||||
|
first = false;
|
||||||
|
s << x;
|
||||||
|
}
|
||||||
|
s << "]";
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
std::ostream & operator << (std::ostream & s, std::set<T> const & v)
|
||||||
|
{
|
||||||
|
s << "{";
|
||||||
|
bool first = true;
|
||||||
|
for (auto const & x : v)
|
||||||
|
{
|
||||||
|
if (!first)
|
||||||
|
s << ", ";
|
||||||
|
first = false;
|
||||||
|
s << x;
|
||||||
|
}
|
||||||
|
s << "}";
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
namespace psemek::util
|
namespace psemek::util
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue