For completeness only: the final version of the code for operator<< :
template <class T, class U> std::ostream& operator<<(std::ostream& oo, const std::set <T,U> & ss){ typename std::set <T,U> ::const_iterator it=ss.begin(); oo << "["; if(it!=ss.end()) oo << (*it++); while(it!=ss.end()) oo << "," << (*it++); oo << "]"; return oo; }
source share