std::basic_spanbuf
From cppreference.com
| ヘッダ <spanstream> で定義 |
||
| template< class CharT, |
(C++23から) | |
std::basic_spanbufは、メモリ常駐の任意の文字シーケンスを管理するstd::basic_streambufです。このシーケンスは、std::span<CharT>のインスタンスから初期化したり、またはそのインスタンスとして提供したりできます。
std::basic_spanbufは固定バッファに対してI/O操作を行うため、基になるバッファが枯渇しても新しいバッファを取得しようとはしません。
一般的な文字型のためにいくつかの typedef が提供されています
| ヘッダ
<spanstream> で定義 | |
| 型 | 定義 |
std::spanbuf
|
std::basic_spanbuf<char> |
std::wspanbuf
|
std::basic_spanbuf<wchar_t> |
目次 |
[編集] メンバ型
| メンバ型 | 定義 |
char_type
|
CharT |
traits_type
|
Traits; Traits::char_type が CharT でない場合、プログラムは不適格となる。 |
int_type
|
Traits::int_type |
pos_type
|
Traits::pos_type |
off_type
|
Traits::off_type |
[編集] データメンバ
| メンバ名 | 定義 |
mod (private) |
オープンモードを記録するstd::ios_base::openmode。 (説明用のメンバオブジェクト*) |
buf (private) |
基になるバッファを参照するstd::span<CharT>。 (説明用のメンバオブジェクト*) |
[編集] メンバ関数
公開メンバ関数 | |
basic_spanbufオブジェクトを構築します(公開メンバ関数) | |
| (デストラクタ) [virtual] |
basic_spanbufオブジェクトを破棄します(仮想 public メンバ関数) |
basic_spanbufオブジェクトを代入します(公開メンバ関数) | |
2つのbasic_spanbufオブジェクトを交換します(公開メンバ関数) | |
| モードに従って基になるバッファを取得または初期化します (公開メンバ関数) | |
Protected member functions | |
| [virtual] |
制御文字シーケンスを配列で置き換えようとする (仮想保護メンバ関数) |
| [virtual] |
入力シーケンス、出力シーケンス、またはその両方で、相対アドレス指定を使用して次のポインタを再配置する (仮想保護メンバ関数) |
| [virtual] |
入力シーケンス、出力シーケンス、またはその両方で、絶対アドレス指定を使用して次のポインタを再配置する (仮想保護メンバ関数) |
[編集] 非メンバ関数
| std::swap アルゴリズムを特殊化する (関数テンプレート) |
std::basic_streambuf から継承
メンバ型
| メンバ型 | 定義 |
char_type
|
CharT |
traits_type
|
Traits; Traits::char_type が CharT でない場合、プログラムは不適格となる。 |
int_type
|
Traits::int_type |
pos_type
|
Traits::pos_type |
off_type
|
Traits::off_type |
メンバ関数
| [virtual] |
basic_streambuf オブジェクトを破棄する( std::basic_streambuf<CharT,Traits> の仮想 public メンバ関数) |
ロケール | |
| 関連するロケールを変更し、imbue() を呼び出す ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
| 関連するロケールのコピーを取得する ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
位置付け | |
| setbuf() を呼び出す ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
| seekoff() を呼び出す ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
| seekpos() を呼び出す ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
| sync() を呼び出す ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
取得領域 | |
| 取得領域ですぐに利用可能な文字数を取得する ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
| 入力シーケンスを進め、その後、再度進めずに1文字を読み取る ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
| (C++17 で削除) |
入力シーケンスから1文字を読み込み、シーケンスを進める ( std::basic_streambuf<CharT,Traits> の public メンバ関数) |
| シーケンスを進めずに、入力シーケンスから1文字を読み取る ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
| xsgetn() を呼び出す ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
配置領域 | |
| 配置領域に1文字を書き込み、次のポインタを進める ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
| xsputn() を呼び出す ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
戻し | |
| 1文字を入力シーケンスに戻す ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
| 入力シーケンスの次のポインタを1つ戻す ( std::basic_streambuf<CharT,Traits> の public メンバ関数) | |
Protected member functions
basic_streambuf オブジェクトを構築する(protected メンバ関数) | |
| (C++11) |
basic_streambuf オブジェクトを置き換える(protected メンバ関数) |
| (C++11) |
2つの basic_streambuf オブジェクトをスワップする(protected メンバ関数) |
ロケール | |
| [virtual] |
関連するロケールの変更に対応する ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
位置付け | |
| [virtual] |
許可されていれば、バッファをユーザー定義配列で置き換える ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
| [virtual] |
入力シーケンス、出力シーケンス、またはその両方で、相対アドレス指定を使用して次のポインタを再配置する ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
| [virtual] |
入力シーケンス、出力シーケンス、またはその両方で、絶対アドレス指定を使用して次のポインタを再配置する ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
| [virtual] |
バッファを関連付けられた文字シーケンスと同期する ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
取得領域 | |
| [virtual] |
分かっていれば、関連付けられた入力シーケンスで入力に利用可能な文字数を取得する ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
| [virtual] |
関連付けられた入力シーケンスから取得領域に文字を読み込む ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
| [virtual] |
関連付けられた入力シーケンスから取得領域に文字を読み込み、次のポインタを進める ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
| [virtual] |
入力シーケンスから複数の文字を読み込む ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
| 取得領域の先頭、現在の文字、および末尾へのポインタを返す (protected メンバ関数) | |
| 入力シーケンスの次のポインタを進める (protected メンバ関数) | |
| 入力シーケンスの先頭、次、および末尾のポインタを再配置する (protected メンバ関数) | |
配置領域 | |
| [virtual] |
出力シーケンスに複数の文字を書き込む ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
| [virtual] |
関連付けられた出力シーケンスに、配置領域から文字を書き込む ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
| 配置領域の先頭、現在の文字、および末尾へのポインタを返す (protected メンバ関数) | |
| 出力シーケンスの次のポインタを進める (protected メンバ関数) | |
| 出力シーケンスの先頭、次、および末尾のポインタを再配置する (protected メンバ関数) | |
戻し | |
| [virtual] |
入力シーケンスに1文字を戻す (入力シーケンスを変更する可能性あり) ( std::basic_streambuf<CharT,Traits> の仮想 protected メンバ関数) |
[編集] 注釈
std::basic_spanbufは、基になるバッファを所有しません。
プログラマは、std::basic_spanbufオブジェクトによって使用されている間、基になるバッファがそのライフタイム内にあることを保証する責任があります。複数のスレッドが異なるstd::basic_spanbufオブジェクトを介して同じ基になるバッファを操作する場合、追加の同期が必要になることがあります。
| 機能テストマクロ | 値 | 規格 | 機能 |
|---|---|---|---|
__cpp_lib_spanstream |
202106L |
(C++23) | std::spanbuf、std::spanstream |
[編集] 関連項目
| 生の文字列デバイスを実装する (クラステンプレート) | |
| (C++98で非推奨)(C++26で削除) |
生の文字配列デバイスを実装する (クラス) |