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 );
반환 값
A reference to the character originally addressed or to an implementation-defined object that is convertible to ostreambuf_iterator<CharType, Traits>.
설명
The operator is used to implement the output iterator expression *i = x.
예제
// 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';
}
요구 사항
헤더: <iterator>
네임스페이스: std