다음을 통해 공유


istream_iterator::operator++

Either extracts an incremented object from the input stream or copies the object before incrementing it and returns the copy.

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

반환 값

The first member operator returns a reference to the incremented object of type Type extracted from the input stream and the second member function returns a copy of the object.

예제

// 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 a

FakePre-ae9c74984fe74da89e40769efc40b33f-2bff00ec4c864d06bd9557fd92792edb

요구 사항

헤더: <iterator>

네임스페이스: std

참고 항목

참조

istream_iterator 클래스

표준 템플릿 라이브러리