ostreambuf_iterator::operator=
The operator inserts a character into the associated stream buffer.
ostreambuf_iterator<CharType, Traits>& operator=(
CharType _Char
);
Parameters
- _Char
The character to be inserted into the stream buffer.
Return Value
A reference to the character inserted into the stream buffer.
Remarks
Assignment operator used to implement the output iterator expression *i = x for writing to an output stream.
Example
// ostreambuf_iterator_op_assign.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