Add << operators for vectors & sets in tests

This commit is contained in:
Nikita Lisitsa 2023-05-06 12:53:25 +03:00
parent 0675585a53
commit aae4fa238f

View file

@ -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
{ {