istream_iterator::operator++
入力ストリームからの拡大されたオブジェクトを配置するか、それをインクリメントする前にオブジェクトをコピーし、そのコピーを返します。
istream_iterator<Type, CharType, Traits, Distance>& operator++( );
istream_iterator<Type, CharType, Traits, Distance> operator++( int );
戻り値
一つ目のメンバー演算子は入力ストリームから抽出された型 [種類] を大きくするオブジェクトへの参照を返し、2 番目のメンバー関数はオブジェクトのコピーを返します。
使用例
// istream_iterator_operator_incr.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
2 4 6 8 a & 空間と文字 (試行の例で区切られた整数を入力します: 「a) : 2 4 6 8 読み取り: 2 4 6 8 読み取ります: 2 読み取ります: 4 読み取ります: 6 8
必要条件
ヘッダー: <iterator>
名前空間: std