名稱空間
變體
操作

std::basic_istream<CharT,Traits>::~basic_istream

來自 cppreference.com
< cpp‎ | io‎ | basic istream
 
 
 
 
virtual ~basic_istream();

銷燬輸入流。

[編輯] 注意

此解構函式不對底層流緩衝區 (rdbuf()) 執行任何操作:std::basic_ifstreamstd::basic_istringstream 等派生輸入流的解構函式負責呼叫流緩衝區的解構函式。

[編輯] 示例

#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';
}

輸出

10,20