istream_iterator::char_type
提供 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;
}
2 4 f
FakePre-05dfd6add76745ae9230000ac6501468-4832e7de3c5646deaea126799638c4f2
要求
标头: <iterator>
命名空间: std