ostreambuf_iterator::operator++
返回 ostream 迭代器指向同一字符上它的不运行增量运算符的操作解决,在调用之前。
ostreambuf_iterator<CharType, Traits>& operator++( );
ostreambuf_iterator<CharType, Traits>& operator++( int );
返回值
引用分配给最初针对的字符或为转换为 ostreambuf_iterator<CharType,特征>的实现所定义的对象。
备注
运算符用于输出表达式实现迭代器 *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