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():
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Pi(π) in C++ with Examples
- cin get() in C++ with Examples
- std::less in C++ with Examples
- mbrtoc16() in C/C++ with Examples
- ios eof() function in C++ with Examples
- negative_binomial_distribution in C++ with Examples
- std::is_heap( ) in C++ with Examples
- mbrtoc32() in C/C++ with Examples
- wmemset() in C/C++ with Examples
- ios bad() function in C++ with Examples
- std::remove_const in C++ with Examples
- std::equal_to in C++ with Examples
- std::bit_xor in C++ with Examples
- Manipulators in C++ with Examples
- std::add_cv in C++ with Examples
- std::is_copy_assignable in C++ with Examples
- std::is_default_constructible in C++ with Examples
- std::is_move_assignable C++ with Examples
- std::is_trivially_destructible in C++ with Examples
- std::is_nothrow_default_constructible in C++ with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.