31 Input/output library [input.output]

31.10 File-based streams [file.streams]

31.10.4 Class template basic_­ofstream [ofstream]

31.10.4.3 Swap [ofstream.swap]

void swap(basic_ofstream& rhs);
Effects: Exchanges the state of *this and rhs by calling basic_­ostream<charT, traits>​::​swap(rhs) and sb.swap(rhs.sb).
template<class charT, class traits> void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
Effects: Equivalent to: x.swap(y).