istream_iterator::operator*
逆参照演算子では istream_iteratorでアドレス指定された型 [種類] に保存されたオブジェクトを返します。
const Type& operator*( ) const;
戻り値
型 [種類] に保存されたオブジェクト。
使用例
// 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 a2
FakePre-a036d4b43aef4dc28f28f9646dbf180c-afd0356c51ba428db0dc981fc5c3c1cd
必要条件
ヘッダー: の <反復子>
名前空間: std