/* * vector-list-IO.h * * Created by Bruce MacLennan on 2008/11/29. * */ #ifndef VECTORLISTIO_H_ #define VECTORLISTIO_H_ #include #include #include #include #include using namespace std; template ostream& operator << (ostream& os, vector & Vref) { typename vector::const_iterator Vi; os << "{"; for (Vi = Vref.begin(); Vi != Vref.end(); Vi++) { os << *Vi; if (Vi+1 != Vref.end()) os << ", "; } os << "}"; return os; } template ostream& operator << (ostream& os, list Lref) { int i = 0; typename list::const_iterator Li; os << "["; for (Li = Lref.begin(); Li != Lref.end(); Li++) { os << *Li; if (++i < (int) Lref.size()) os << ", "; } os << "]"; return os; } #endif /* VECTORLISTIO_H_ */