template <class charT, class traits, class Alloc> void swap (basic_ostringstream<charT,traits,Alloc>& x, basic_ostringstream<charT,traits,Alloc>& y);
1234567891011121314151617181920
// swapping ostringstream objects #include <string> // std::string #include <iostream> // std::cout #include <sstream> // std::ostringstream int main () { std::ostringstream foo; std::ostringstream bar; foo << 100; bar << 200; swap(foo,bar); // unqualified (uses argument-dependent lookup) std::cout << "foo: " << foo.str() << '\n'; std::cout << "bar: " << bar.str() << '\n'; return 0; }
foo: 200 bar: 100