/* $Id: output.h 1109 2007-04-17 00:04:26Z rvernica $ Copyright (C) 2007 by The Regents of the University of California Redistribution of this file is permitted under the terms of the GNU Public License (GPL). Date: 01/30/2007 Author: Rares Vernica */ #ifndef _output_h_ #define _output_h_ #include #include #include #include #include #include #include #include using namespace std; using namespace tr1; template ostream& operator<<(ostream& out, const vector &v) { out << '['; for(typename vector::const_iterator it = v.begin(); it != v.end(); it++) { if (it != v.begin()) { out << ", "; } out << *it; } out << ']'; return out; } template ostream& operator<<(ostream& out, const set &v) { out << '('; for(typename set::const_iterator it = v.begin(); it != v.end(); it++) { if (it != v.begin()) { out << ", "; } out << *it; } out << ')'; return out; } template ostream& operator<<(ostream& out, const unordered_set &v) { out << '('; for(typename unordered_set::const_iterator it = v.begin(); it != v.end(); it++) { if (it != v.begin()) { out << ", "; } out << *it; } out << ')'; return out; } template ostream& operator<<(ostream& out, const map &v) { out << '('; for(typename map::const_iterator it = v.begin(); it != v.end(); it++) { if (it != v.begin()) { out << ", "; } out << *it; } out << ')'; return out; } template ostream& operator<<(ostream& out, const unordered_map &v) { out << '('; for(typename unordered_map::const_iterator it = v.begin(); it != v.end(); it++) { if (it != v.begin()) { out << ", "; } out << *it; } out << ')'; return out; } template ostream& operator<<(ostream& out, const pair &p) { return out << '(' << p.first << ',' << p.second << ')'; } #endif