ostreambuf_iterator::char_type

ostreambuf_iterator提供的字符的类型。

typedef CharType char_type;

备注

类型作为模板参数的 CharType的同义词。

示例

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

int main( )
{
   using namespace std;

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

   // ostreambuf_iterator for stream cout
   // with new line delimiter:
    ostreambuf_iterator< CHT1, CHTR1> charOutBuf ( cout );

   // Standard iterator interface for writing
   // elements to the output streambuf:
   cout << "The characters written to the output stream\n"
        << " by charOutBuf are: ";
   *charOutBuf = 'O';
   charOutBuf++;
   *charOutBuf = 'U';
   charOutBuf++;
   *charOutBuf = 'T';
   charOutBuf++;
   cout << "." << endl;
}
  

要求

头文件: <iterator>

命名空间: std

请参见

参考

ostreambuf_iterator 类

标准模板库