istream_iterator::traits_type

문자 특성 형식을 제공 하는 형식에서 istream_iterator.

typedef Traits traits_type;

설명

템플릿 매개 변수에 대 한 동의어입니다 특성.

예제

// 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의
  10 20의
정수 공백으로 구분 하 여 입력 & 다음 문자 (예제: ' 10 20는 '): 10 읽기는 20: 10 읽기: 20

요구 사항

헤더: <iterator>

네임 스페이스: std

참고 항목

참조

istream_iterator Class

표준 템플릿 라이브러리