返回成员的值,因此,如果任何一个。
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)
(1,2) (3,4) (a,b) 输入空格分隔的复数&字符然后对(尝试示例:“(1,2) (3,4) (a,b):(1,2) (3,4) (a,b)读取实部:1将虚拟部分:2将实部:3将虚拟部分:4
要求
标头: <iterator>
命名空间: std