類模板
<sstream>

std::basic_stringbuf

template < class charT,                           // basic_stringbuf::char_type           class traits = char_traits<charT>,     // basic_stringbuf::traits_type           class Alloc = allocator<charT>         // basic_stringbuf::allocator_type           > class basic_stringbuf;
字串流緩衝區

用於從 basic_string 物件讀取和寫入的流緩衝區。

此類物件在內部維護一個字元序列,它們將其用作“關聯輸入序列”和/或“關聯輸出序列”。可以透過成員函式 strbasic_string 物件初始化內部序列,或將其複製到其中。

透過此類中重寫的、從 basic_streambuf 繼承的虛成員所提供的介面,將對字元內部序列的訪問提供給流。

模板引數

charT
“流緩衝區”和它接受或生成的 basic_string 物件所使用的字元型別。
這應是一個非陣列的 POD 型別
作為成員型別 basic_stringbuf::char_type 的別名。
特性 (traits)
字元特性類,定義了流和字串物件所用字元的基本屬性(請參閱 char_traits)。
traits::char_type 應當與 charT 相同。
作為成員型別 basic_stringbuf::traits_type 的別名。
Alloc
用於定義 basic_string 物件儲存分配模型的分配器物件的型別。
預設情況下,使用 allocator 類模板,它定義了最簡單的記憶體分配模型,並且與值無關。
作為成員型別 basic_stringbuf::allocator_type 的別名。

sub_match for string literals (class)

這些例項化宣告在 <sstream> 中。

成員型別

成員型別定義說明
char_type第一個模板引數(charT
traits_type第二個模板引數(traits預設為:char_traits<charT>
allocator_type第三個模板引數(Alloc預設為:allocator<charT>
int_typetraits_type::int_type
pos_typetraits_type::pos_type通常與 streampos 相同
off_typetraits_type::off_type通常與 streamoff 相同

公開成員函式


basic_streambuf 繼承的公共成員函式

區域設定:
緩衝區管理和定位:
輸入函式 (get):
輸出函式 (put):

受保護的虛擬函式重寫


此類還繼承了其他非虛成員或未被重寫的受保護成員。有關更多詳細資訊,請參閱基類 basic_streambuf