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 , ' ' , '.' );
}
太多的点 doneSo
FakePre-8d4abac7e62e4bbab13292ec00f7fc88-01a3e68b0e2142f98f08810f48479ad8
要求
头文件: <iterator>
命名空间: std