istreambuf_iterator::operator++
傳回輸入資料流的下一個字元或在加入之前複製物件並傳回複本。
istreambuf_iterator<CharType, Traits>& operator++( );
istreambuf_iterator<CharType, Traits> operator++( int );
傳回值
istreambuf_iterator 或參考為 istreambuf_iterator。
備註
第一個運算子最後嘗試從關聯的輸入資料流擷取和儲存型別 CharType 物件。 第二個運算子來複製物件,加入物件,然後傳回複本。
範例
// istreambuf_iterator_operator_incr.cpp
// compile with: /EHsc
#include <iterator>
#include <iostream>
int main( )
{
using namespace std;
cout << "Type string of characters & enter to output it,\n"
<< " with stream buffer iterators,(try: 'I'll be back.')\n"
<< " repeat as many times as desired,\n"
<< " then keystroke ctrl-Z Enter to exit program: ";
istreambuf_iterator<char> inpos ( cin );
istreambuf_iterator<char> endpos;
ostreambuf_iterator<char> outpos ( cout );
while ( inpos != endpos )
{
*outpos = *inpos;
++inpos; //Increment istreambuf_iterator
++outpos;
}
}
我會傳回。
FakePre-90cf8e99724840b897bcdfb2c64020d7-694b3d927fa4467f9f3993a505314211
需求
標頭:<迭代器>
命名空間: std