public member function
<fstream>

std::basic_filebuf::swap

void swap (basic_filebuf& x);
Swap file buffers
Exchanges the contents and state of x and *this. This includes the internal pointers and the locale object.

Parameters

x
Another basic_filebuf object of the same type (i.e., instantiated with the same template parameters, charT and traits).

Return value

none

Data races

Modifies both basic_filebuf objects (*this and x).
Concurrent access to the same file stream buffer objects may introduce data races.

Exception safety

Basic guarantee: if an exception is thrown, the file stream buffer is in a valid state.

See also