Namespaces
Variants

std::basic_osyncstream<CharT,Traits,Allocator>:: operator=

From cppreference.net
basic_osyncstream & operator = ( std:: basic_osyncstream && other ) ;
(C++20부터)

동기화된 출력 스트림을 이동 할당합니다:

래핑된 std::basic_syncbuf other 의 해당 멤버로부터 이동 할당합니다 (이 이동 할당 이후, other. get_wrapped ( ) 는 널 포인터를 반환하며 other 의 소멸은 출력을 생성하지 않습니다; 모든 대기 중인 버퍼링된 출력은 방출됩니다). 그리고 기본 std::basic_ostream 이동 할당합니다 (이는 rdbuf 를 제외한 모든 스트림 상태 변수들을 * this other 사이에서 교환합니다)

목차

매개변수

other - 이동할 다른 동기화된 출력 스트림

반환값

* this

예제

#include <iomanip>
#include <iostream>
#include <sstream>
#include <syncstream>
#include <utility>
int main()
{
    std::osyncstream out(std::cout);
    out << "test\n";
    std::ostringstream str_out;
    std::osyncstream{str_out} = std::move(out); // Note that out is emitted here
    std::cout << "str_out = " << std::quoted(str_out.view()) << '\n';
}

출력:

test
str_out = ""

결함 보고서

다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 3867 C++20 이동 할당 연산자가 noexcept 로 지정되었으나,
std::basic_syncbuf 의 이동 할당 연산자는 그렇지 않음
noexcept 제거

참고 항목

basic_osyncstream 객체를 생성합니다
(public member function)
basic_osyncstream 을 파괴하고 내부 버퍼를 출력합니다
(public member function)
내부 데이터를 최종 목적지로 전송하기 위해 기본 basic_syncbuf 에서 emit() 를 호출합니다
(public member function)