std::basic_streambuf<CharT,Traits>:: ~basic_streambuf
From cppreference.net
<
cpp
|
io
|
basic streambuf
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_streambuf
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
virtual
~basic_streambuf
(
)
;
|
||
このデストラクタは何の効果も持ちません:この
basic_streambuf
のメンバー(ポインタとロケール)は、このデストラクタが戻った後に通常のオブジェクト破棄シーケンスに従って破棄されます。しかし、public virtualとして宣言されているため、
std::basic_streambuf
から派生したオブジェクトを基底クラスへのポインタを通して削除することが可能になります。
目次 |
パラメータ
(なし)
例
このコードを実行
#include <fstream> #include <iostream> int main() { std::filebuf* fbp = new std::filebuf; fbp->open("test.txt", std::ios_base::out); fbp->sputn("Hello\n", 6); std::streambuf* sbp = fbp; delete sbp; // the file is closed, output flushed and written std::ifstream f("test.txt"); std::cout << f.rdbuf(); // proof }
出力:
Hello
欠陥報告
以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 54 | C++98 | デストラクタの効果が規定されていなかった | 効果なしとして規定 |
関連項目
basic_streambuf
オブジェクトを構築する
(protected member function) |