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-cda9041e3808417399fa0f5ce8279278-e7767ecdbd854527b43039ee3b3682f0

要求

头文件: <iterator>

命名空间: std

请参见

参考

istreambuf_iterator 类

标准模板库