std::basic_istream<CharT,Traits>:: ~basic_istream
From cppreference.net
<
cpp
|
io
|
basic istream
C++
Input/output library
| 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)
|
std::basic_istream
| 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
(
)
;
|
||
析构输入流。
注释
此析构函数不对底层流缓冲区(
rdbuf()
)执行任何操作:派生输入流(如
std::basic_ifstream
和
std::basic_istringstream
)的析构函数负责调用流缓冲区的析构函数。
示例
运行此代码
#include <iostream> #include <sstream> void print_stringbuf(std::streambuf* p) { std::istream buf(p); // buf 与 s1 共享缓冲区 int n; buf >> n; std::cout << n; } // 调用 buf 的析构函数,p 不受影响 int main() { std::istringstream s1("10 20"); print_stringbuf(s1.rdbuf()); int n; s1 >> n; std::cout << ',' << n << '\n'; }
输出:
10,20