다음을 통해 공유


istream_iterator::operator->

Returns the value of a member, if any.

const Type* operator->( ) const;

반환 값

The value of a member, if any.

설명

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

The operator returns &**this.

예제

// 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-0fbd4c814fc043fda74ab502704e88c3-7a781c5484004d0bbf1c4c4bc1931d0a

요구 사항

헤더: <iterator>

네임스페이스: std

참고 항목

참조

istream_iterator 클래스

표준 템플릿 라이브러리