Compartilhar via


istream_iterator::operator->

Returns the value of a member, if any.

const Type* operator->( ) const;

Return Value

The value of a member, if any.

Remarks

i -> is equivalent to (*i).m

The operator returns &**this.

Example

// istream_iterator_operator_vm.cpp
// compile with: /EHsc
#include <iterator>
#include <iostream>
#include <complex>

using namespace std;

int main( )
{
   cout << "Enter complex numbers separated by spaces & then\n"
        << " a character pair ( try example: '(1,2) (3,4) (a,b)' ): ";

   // istream_iterator from stream cin
   istream_iterator< complex<double> > intRead ( cin );

   // End-of-stream iterator
   istream_iterator<complex<double> > EOFintRead;

   while ( intRead != EOFintRead )
   {
      cout << "Reading the real part: " << intRead ->real( ) << endl;
      cout << "Reading the imaginary part: " << intRead ->imag( ) << endl;
      ++intRead;
   }
   cout << endl;
}
  (1,2) (3,4) (a,b)

FakePre-5f49a5e4c2ce49f18bb10198246e6e58-f35dbc9bf1bf46418930d7828d8f8ce0

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

istream_iterator Class

Standard Template Library

Other Resources

istream_iterator Members