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-6a5af8e529b54e80a23d8564bce8308e-9e199ba01f024f25a7cc90008d524ca1
Requirements
Header: <iterator>
Namespace: std