Namespaces
Variants

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

From cppreference.net
(1) (C++11 이후)
std:: basic_stringbuf & operator = ( const std:: basic_stringbuf & rhs ) = delete ;
(2)
1) 이동 할당 연산자: rhs 의 내용을 * this 로 이동합니다. 이동 후, * this 는 연결된 문자열, 열기 모드, 로케일 및 rhs 가 이전에 보유했던 모든 다른 상태를 가지게 됩니다. std::basic_streambuf 의 여섯 개 포인터는 * this 에서 null이 아닌 경우, 이동된 rhs 의 해당 포인터들과 다르다는 것이 보장됩니다.
2) 복사 할당 연산자가 삭제됨; basic_stringbuf CopyAssignable 을 만족하지 않음.

목차

매개변수

rhs - 이동될 다른 basic_stringbuf 객체

반환값

* this

예제

#include <iostream>
#include <sstream>
#include <string>
int main()
{
    std::istringstream one("one");
    std::ostringstream two("two");
    std::cout << "Before move, one = \"" << one.str() << '"'
              << " two = \"" << two.str() << "\"\n";
    *one.rdbuf() = std::move(*two.rdbuf());
    std::cout << "After move, one = \"" << one.str() << '"'
              << " two = \"" << two.str() << "\"\n";
}

출력:

Before move, one = "one" two = "two"
After move, one = "two" two = ""

참고 항목

basic_stringbuf 객체를 생성합니다
(public member function)