Partager via


istream_iterator::char_type

A type that provides for the character type of the istream_iterator.

typedef CharType char_type;

Remarks

The type is a synonym for the template parameter Chartype.

Example

// 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-b8e7035f7b9f47bb97b0e9a90fd744f6-70d57159e3d8448ca240c838c74d2f68

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

istream_iterator Class

Standard Template Library

Other Resources

istream_iterator Members