Namespaces
Variants

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

From cppreference.net
virtual ~basic_ostream ( ) ;

basic_ostream 객체를 파괴합니다. 이 소멸자는 기본 스트림 버퍼( rdbuf() )에 대해 어떠한 연산도 수행하지 않습니다: std::basic_ofstream std::basic_ostringstream 과 같은 파생 출력 스트림들의 소멸자들이 스트림 버퍼들의 소멸자를 호출할 책임이 있습니다.

예제

#include <iostream>
#include <sstream>
void add_words(std::streambuf* p)
{
    std::ostream buf(p); // buf는 s와 버퍼를 공유합니다
    buf << " is the answer";
} // buf의 소멸자를 호출합니다. p는 영향을 받지 않습니다
int main()
{
    std::ostringstream s;
    s << 42;
    add_words(s.rdbuf());
    s << ".";
    std::cout << s.str() << '\n';
}

출력:

42 is the answer.