Partilhar via


istream_iterator::operator->

Retorna o valor de um membro, se houver.

const Type* operator->( ) const;

Valor de retorno

O valor de um membro, se houver.

Comentários

i -> é equivalente a *i () .m

O operador retorna &**this.

Exemplo

// 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-c7f6fdccb1224ce7bf8ce1cf52f16509-9f622acb5c2d4f5c9eef82528d88d95a

Requisitos

Cabeçalho: <iterator>

Namespace: std

Consulte também

Referência

Classe istream_iterator

Biblioteca de Modelos Padrão