Partager via


istream_iterator::char_type

Type qui fournit le type de caractère de l'objet istream_iterator.

typedef CharType char_type;

Notes

Le type est un synonyme du paramètre de modèle Chartype.

Exemple

// 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-a3db948dd1174ca7ae5c82db9979bf7a-c4eeed7bdecc4de5bcbffb2162d251bf

Configuration requise

En-tête : <iterator>

Espace de noms : std

Voir aussi

Référence

istream_iterator, classe

Bibliothèque STL (Standard Template Library)