다음을 통해 공유


istream_iterator::operator*

The dereferencing operator returns the stored object of type Type addressed by the istream_iterator.

const Type& operator*( ) const;

Return Value

The stored object of type Type.

Example

// istream_iterator_operator.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-7a950e150a62469d817ee1e6e5e1a0a9-3195e782fd1e494785273106d51ccf62

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

istream_iterator Class

Standard Template Library

Other Resources

istream_iterator Members