istream_iterator::operator->
傳回成員的值,則為,如果其中任何一個。
const Type* operator->( ) const;
傳回值
成員的值,則為,如果其中任何一個。
備註
我 - >相當於 (*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-3c5e696b770541789dcad93cb7d8baed-ffa0fc686ec946bbad08db7e2ffb1456
需求
標題: <iterator>
命名空間: std