istream_iterator::traits_type
Um tipo prever o tipo de características de caractere de istream_iterator.
typedef Traits traits_type;
Comentários
O tipo é um sinônimo para o parâmetro Característicasdo modelo.
Exemplo
// 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 a
FakePre-1f14221dde0740249d3128acd4897256-87947f5b038f4c28b6eb4ff19d3d3327
Requisitos
Cabeçalho: <iterator>
Namespace: std