| I/O manipulators | ||||
| Print functions(C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++20) | ||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
| Synchronized Output | ||||
(C++20) | ||||
| Types | ||||
| Error category interface | ||||
(C++11) | ||||
(C++11) |
| Global objects | ||||
| Member functions | ||||
basic_istream::~basic_istream | ||||
(C++11) | ||||
| Formatted input | ||||
| Unformatted input | ||||
| Positioning | ||||
| Miscellaneous | ||||
(C++11) | ||||
| Member classes | ||||
| Non-member functions | ||||
virtual ~basic_istream(); | ||
Destructs the input stream.
This destructor does not perform any operation on the underlying streambuffer (rdbuf()): the destructors of the derived input streams such asstd::basic_ifstream andstd::basic_istringstream are responsible for calling the destructors of the streambuffers.
#include <iostream>#include <sstream> void print_stringbuf(std::streambuf* p){std::istream buf(p);// buf shares the buffer with s1int n; buf>> n;std::cout<< n;}// calls the destructor of buf. p remains unaffected int main(){std::istringstream s1("10 20"); print_stringbuf(s1.rdbuf());int n; s1>> n;std::cout<<','<< n<<'\n';}
Output:
10,20