istream_iterator::traits_type
提供 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。
FakePre-ff717fb8598848a9aeecbdec3b941342-7279e63d146c4a988cc80253d312ae17
需求
標題: <iterator>
命名空間: std