
26 Sep
2011
26 Sep
'11
8:08 a.m.
In short, you'll have to define a global operator<< for type std::pair<T, U>:
template<typename CharType, typename T, typename U> std::basic_ostream<CharType>& operator<< (std::basic_ostream<CharType>& o, std::pair<T, U> mypair) { return o << "This is my way of printing a pair: first: " << mypair.first << " and second: " << mypair.second; }
This is strictly forbidden by the standard AFAIK.
How can the standard forbid defining your own operators? The standard forbids putting things into std namespace.