std::basic_...sic_istream(3)
π std::basic_istream::~basic_istream π
okay so bestie, this page lives in the C++ Standard Libary manual, and the page itself is std::basic_...sic_istream(3) β weβre here for std::basic_istream::~basic_istream. Itβs giving destructor era and weβre obsessed β¨
πΈ NAME πΈ
std::basic_istream::~basic_istreamβstd::basic_istream::~basic_istream
π Synopsis π
virtual ~basic_istream();
This is the destructor, and it destructs the input stream. slay π
π¦ Notes π¦
Real talk: this destructor does not perform any operation on the underlying streambuffer (rdbuf()). It is not the one handling that.
The destructors of the derived input streams β such as std::basic_ifstream and std::basic_istringstream β are the ones responsible for calling the destructors of the streambuffers. periodt π«Ά
π Example π
// Run this code
#include <iostream>
#include <sstream>
void print_stringbuf(std::streambuf* p)
{
std::istream buf(p); // buf shares the buffer with s1
int 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
xoxo, your local Unix bestie π β source: cppreference.com, version date: 2024.06.10, page: std::basic_...sic_istream(3) π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms