ostreambuf_iterator::operator++
A nonfunctional increment operator that returns an ostream iterator to the same character it addressed before the operation was called.
ostreambuf_iterator<CharType, Traits>& operator++( );
ostreambuf_iterator<CharType, Traits>& operator++( int );
Return Value
A reference to the character originally addressed or to an implementation-defined object that is convertible to ostreambuf_iterator<CharType, Traits>.
Remarks
The operator is used to implement the output iterator expression *i = x.
Example
// ostreambuf_iterator_op_incr.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>
int main( )
{
using namespace std;
// ostreambuf_iterator for stream cout
// with new line delimiter
ostreambuf_iterator<char> charOutBuf ( cout );
// Standard iterator interface for writing
// elements to the output stream
cout << "Elements written to output stream:" << endl;
*charOutBuf = 'O';
charOutBuf++; // No effect on iterator position
*charOutBuf = 'U';
*charOutBuf = 'T';
}
Elements written to output stream:
OUT
Requirements
Header: <iterator>
Namespace: std