次の方法で共有


ostream_iterator::operator++

同じオブジェクトに ostream_iterator を返す、機能面以外のインクリメント演算子は、操作が呼び出される前にアドレス。

ostream_iterator<Type, CharType, Traits>& operator++( );
ostream_iterator<Type, CharType, Traits> operator++( int );

戻り値

ostream_iteratorへの参照。

解説

これらのメンバー演算子は *this両方を返します。

使用例

// ostream_iterator_op_incr.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>

int main( )
{
   using namespace std;

   // ostream_iterator for stream cout
   // with new line delimiter
   ostream_iterator<int> intOut ( cout , "\n" );

   // standard iterator interface for writing
   // elements to the output stream
   cout << "Elements written to output stream:" << endl;
   *intOut = 10;
   intOut++;      // No effect on iterator position
   *intOut = 20;
   *intOut = 30;
}
  

必要条件

ヘッダー: <iterator>

名前空間: std

参照

関連項目

ostream_iterator Class

標準テンプレート ライブラリ