istream_iterator提供的字符的类型。
typedef CharType char_type;
备注
类型作为模板参数的 Chartype的同义词。
示例
// istream_iterator_char_type.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>
int main( )
{
using namespace std;
typedef istream_iterator<int>::char_type CHT1;
typedef istream_iterator<int>::traits_type CHTR1;
// Standard iterator interface for reading
// elements from the input stream:
cout << "Enter integers separated by spaces & then\n"
<< " any character ( try example: '2 4 f' ): ";
// istream_iterator for reading int stream
istream_iterator<int, CHT1, CHTR1> intRead ( cin );
// End-of-stream iterator
istream_iterator<int, CHT1, CHTR1> EOFintRead;
while ( intRead != EOFintRead )
{
cout << "Reading: " << *intRead << endl;
++intRead;
}
cout << endl;
}
f2
FakePre-052c00c8f1d34f759ce1e63903062e3f-5bfcfad2fe9040eb8ec1e27e2be59e5c
要求
头文件: <iterator>
命名空间: std