共用方式為


istreambuf_iterator::char_type

提供 ostreambuf_iterator的字元型別的型別。

typedef CharType char_type;

備註

這個型別是樣板參數的 CharType一個同義資料表。

範例

// istreambuf_iterator_char_type.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>
#include <algorithm>

int main( )
{
   using namespace std;

   typedef istreambuf_iterator<char>::char_type CHT1;
   typedef istreambuf_iterator<char>::traits_type CHTR1;

   cout << "(Try the example: 'So many dots to be done'\n"
        << " then an Enter key to insert into the output,\n"
        << " & use a ctrl-Z Enter key combination to exit): ";

   // istreambuf_iterator for input stream
   istreambuf_iterator< CHT1, CHTR1> charInBuf ( cin );
   ostreambuf_iterator<char> charOut ( cout );

   // Used in conjunction with replace_copy algorithm
   // to insert into output stream and replace spaces
   // with dot-separators
   replace_copy ( charInBuf , istreambuf_iterator<char>( ),
        charOut , ' ' , '.' );
}
  將進行的許多點
  將進行的許多點
(請嘗試這個範例:「是 done 然後輸入鍵會插入至輸出, &使用 CTRL Z 的許多點輸入按鍵組合結束):有許多的點完成的 So.many.dots.to.be.do ne ^Z

需求

標題: <iterator>

命名空間: std

請參閱

參考

istreambuf_iterator Class

標準樣板程式庫