std::flush_emit

std::flush_emit (flush + emit 조작자)

출력 시퀀스 osos.flush()처럼 비우고, os.rdbuf()std::basic_syncbuf를 가리키면 buf.emit()을 호출하는 조작자예요. C++20부터 있어요.

출처: cppreference

본문

<ostream> 헤더에 정의돼 있어요.

template< class CharT, class Traits >
std::basic_ostream<CharT, Traits>& flush_emit( std::basic_ostream<CharT, Traits>& os );

출력 시퀀스 osos.flush()를 호출한 것처럼 비워요. 그런 다음 os.rdbuf()가 실제로 std::basic_syncbuf<CharT, Traits, Allocator> 버퍼 buf를 가리키면 buf.emit()을 호출해요. 출력 전용 I/O 조작자라 std::basic_ostream 타입의 out에 대해 out << std::flush_emit처럼 쓸 수 있어요.

매개변수

  • os — 출력 스트림에 대한 참조.

반환값

os(조작 후 스트림에 대한 참조).

예제

#include <syncstream>
#include <iostream>

int main()
{
    std::osyncstream out(std::cout);
    out << "일부 내용";
    out << std::flush_emit;  // 버퍼를 비우고 emit
}

더 알아보기 (Learn more)

cppreference