提供 istream_iterator的特征的功能类型的类型。
typedef Traits traits_type;
备注
该类型是模板参数的 Traits同义词。
示例
// istream_iterator_traits_type.cpp
// compile with: /EHsc
#include <iterator>
#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: '10 20 a' ): ";
// 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;
}
10 20。
10 20。 输入空格&则所有字符分隔的整数(尝试示例:“10 20):10 20读取:10为:20
要求
标头: <iterator>
命名空间: std