template <class charT, class traits> void swap (basic_ofstream<charT,traits>& x, basic_ofstream<charT,traits>& y);
123456789101112131415
// swapping ofstream objects #include <fstream> // std::ofstream int main () { std::ofstream foo; std::ofstream bar ("test.txt"); swap(foo,bar); foo << "lorem ipsum"; foo.close(); return 0; }