20 #ifndef GAIA_STREAMUTIL_H 21 #define GAIA_STREAMUTIL_H 30 #define PR(x) std::cout << #x << ": " << x << std::endl 35 template <
typename T,
template<
typename>
class C>
36 std::ostream& operator<<(std::ostream& out, const C<T>& c) {
37 out <<
'{';
if (!c.empty()) {
38 out << *c.begin();
typename C<T>::const_iterator it = c.begin(); ++it;
39 for (; it != c.end(); ++it) out <<
", " << *it;
49 std::ostream& operator<<(std::ostream& out, const std::vector<T>& v) {
50 out <<
'[';
if (!v.empty()) {
51 out << *v.begin();
typename std::vector<T>::const_iterator it = v.begin();
52 for (++it; it != v.end(); ++it) out <<
", " << *it;
60 template <
typename T,
typename U>
61 std::ostream& operator<<(std::ostream& out, const std::pair<T, U>& p) {
62 return out <<
'<' << p.first <<
',' << p.second <<
'>';
68 inline std::ostream& operator<<(std::ostream& out,
const std::string& str) {
69 return out << str.c_str();
76 #endif // GAIA_STREAMUTIL_H Definition: baseexception.h:26