Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

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

      From cppreference.com
      <cpp‎ |io‎ |basic ostream
       
       
       
       
      virtual ~basic_ostream();

      Destroys thebasic_ostream object. This destructor does not perform any operation on the underlying streambuffer (rdbuf()): the destructors of the derived output streams such asstd::basic_ofstream andstd::basic_ostringstream are responsible for calling the destructors of the stream buffers.

      [edit]Example

      Run this code
      #include <iostream>#include <sstream> void add_words(std::streambuf* p){std::ostream buf(p);// buf shares the buffer with s    buf<<" is the answer";}// calls the destructor of buf. p remains unaffected int main(){std::ostringstream s;    s<<42;    add_words(s.rdbuf());    s<<".";std::cout<< s.str()<<'\n';}

      Output:

      42 is the answer.
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/io/basic_ostream/%7Ebasic_ostream&oldid=158548"

      [8]ページ先頭

      ©2009-2025 Movatter.jp