The basic_ios::swap(x) is used swap all data members of the base class except for rdbuf(), and swaps the values of the gcount() counters between *this and x. This basic_ios::swap(x) function is a protected function. Below is the syntax and the header file for the same:
void swap (basic_istream& x);
Parameter: It accepts the following parameter:
- x : It represents the another object with the same parameter.
Return Value: The method basic_istream::get() doesn’t return anything.
Below are the programs to demonstrate basic_istream::swap():