istream_iterator::operator*
The dereferencing operator returns the stored object of type Type addressed by the istream_iterator.
const Type& operator*( ) const;
반환 값
The stored object of type Type.
예제
// istream_iterator_operator.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <algorithm>
#include <iostream>
int main( )
{
using namespace std;
cout << "Enter integers separated by spaces & then\n"
<< " a character ( try example: '2 4 6 8 a' ): ";
// istream_iterator from stream cin
istream_iterator<int> intRead ( cin );
// End-of-stream iterator
istream_iterator<int> EOFintRead;
while ( intRead != EOFintRead )
{
cout << "Reading: " << *intRead << endl;
++intRead;
}
cout << endl;
}
2 4 6 8 a
FakePre-d34e688fc3144037bb35cd9cc15dd953-727e567696b6450a88b74d462c638ade
요구 사항
헤더: <iterator>
네임스페이스: std