
26 Sep
2011
26 Sep
'11
2:08 p.m.
In short, you'll have to define a global operator<< for type std::pair
: template
std::basic_ostream<CharType>& operator<< (std::basic_ostream<CharType>& o, std::pair 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.