Created
May 28, 2011 12:51
-
-
Save taksatou/996840 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <memory> | |
using namespace std; | |
template <typename T, typename U> | |
ostream& operator<<(ostream& os, const pair<T, U> p) { | |
os << '(' << p.first << ',' << p.second << ')'; | |
return os; | |
} | |
template <typename T, | |
template <typename _1, typename _2=allocator<_1> > class Container> | |
ostream& operator<<(ostream& os, const Container<T>& p) { | |
typename Container<T>::const_iterator e = p.end(); | |
for (typename Container<T>::const_iterator it = p.begin(); it != e; ++it) | |
os << *it << '\n'; | |
return os; | |
} | |
template <typename T, | |
template <typename _1, typename _2, typename _3=allocator<_1> > class Container, | |
template <typename> class Compare> | |
ostream& operator<<(ostream& os, const Container<T, Compare<T> >& p) { | |
typename Container<T, Compare<T> >::const_iterator e = p.end(); | |
for (typename Container<T, Compare<T> >::const_iterator it = p.begin(); it != e; ++it) | |
os << *it << '\n'; | |
return os; | |
} | |
template <typename T, typename U, | |
template <typename _1, typename _2, typename _3, typename _4=allocator<pair<const _1, _2> > > class Container, | |
template <typename> class Compare> | |
ostream& operator<<(ostream& os, const Container<T, U, Compare<T> >& p) { | |
typename Container<T, U, Compare<T> >::const_iterator e = p.end(); | |
for (typename Container<T, U, Compare<T> >::const_iterator it = p.begin(); it != e; ++it) | |
os << *it << '\n'; | |
return os; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment