다음을 통해 공유


ostreambuf_iterator::operator=

The operator inserts a character into the associated stream buffer.

ostreambuf_iterator<CharType, Traits>& operator=(
   CharType _Char
);

매개 변수

  • _Char
    The character to be inserted into the stream buffer.

반환 값

A reference to the character inserted into the stream buffer.

설명

Assignment operator used to implement the output iterator expression *i = x for writing to an output stream.

예제

// 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

참고 항목

참조

ostreambuf_iterator 클래스

표준 템플릿 라이브러리