运算符字符插入到关联的流缓冲区。
ostreambuf_iterator<CharType, Traits>& operator=(
CharType _Char
);
参数
- _Char
要插入的字符到流缓冲区。
返回值
指向字符的引用插入流缓冲区。
备注
赋值运算符用于实现输出迭代器表达式编写的*i = x 写入输出流。
示例
// 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';
}
要求
标头: <iterator>
命名空间: std