istream_iterator::operator++

중 증가 개체 입력된 스트림에서 추출 또는 증가 하기 전에 개체를 복사 하 고 복사본을 반환.

istream_iterator<Type, CharType, Traits, Distance>& operator++( ); 
istream_iterator<Type, CharType, Traits, Distance> operator++( int );

반환 값

첫 번째 멤버 연산자 증가 개체 형식에 대 한 참조를 반환 형식 입력 스트림과 복사본 개체의 두 번째 멤버 함수 반환 값을 추출 합니다.

예제

// istream_iterator_operator_incr.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <algorithm>
#include <iostream>

int main( )
{
   using namespace std;

   cout << "Enter integers separated by spaces & then\n"
        << " a character ( try example: '2 4 6 8 a' ): ";

   // istream_iterator from stream cin
   istream_iterator<int> intRead ( cin );

   // End-of-stream iterator
   istream_iterator<int> EOFintRead;

   while ( intRead != EOFintRead )
   {
      cout << "Reading:  " << *intRead << endl;
      ++intRead;
   }
   cout << endl;
}
  2 4 6 8는
  2 4 6 8는
정수 공백으로 구분 하 여 입력 및 다음 문자 (예제: ' 2 4 6 8는 '): 읽기는 2 4 6 8: 2 읽기: 4 읽기: 6 읽기: 8

요구 사항

헤더: <iterator>

네임 스페이스: std

참고 항목

참조

istream_iterator Class

표준 템플릿 라이브러리