다음을 통해 공유


istream_iterator::char_type

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

typedef CharType char_type;

설명

The type is a synonym for the template parameter Chartype.

예제

// 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-f16893b82da94cb9a7c741b241b9534f-68ba744aaebc466396a0f78abcc3bcaa

요구 사항

헤더: <iterator>

네임스페이스: std

참고 항목

참조

istream_iterator 클래스

표준 템플릿 라이브러리