istream_iterator::operator->
返回成员的值,因此,如果任何一个。
const Type* operator->( ) const;
返回值
成员的值,因此,如果任何一个。
备注
i - >等效于(*i) .m
运算符返回 &**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-1a6afe7bab7c4d72931d8a2f605f92c2-c284deff014d4d0e8c4fb01acb4b7f87
要求
标头: <iterator>
命名空间: std