public member function
<fstream>

std::filebuf::swap

void swap (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 filebuf object of the same type (i.e., instantiated with the same template parameters, charT and traits).

Return value

none

Data races

Modifies both 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