istream_iterator::operator++
输入流提取一增加的对象或在增大前复制该对象并返回副本。
istream_iterator<Type, CharType, Traits, Distance>& operator++( );
istream_iterator<Type, CharType, Traits, Distance> operator++( int );
返回值
第一个成员运算符返回对输入流提取的类型 Type 增加的对象,第二个成员函数返回对象的副本。
示例
// 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。
FakePre-ec7ce1e7de7e45bc89c67af01ec51394-567316490d884ddaa0ce1c76c0d3d243
要求
标头: <iterator>
命名空间: std