std::basic_stringbuf<CharT,Traits,Allocator>::operator=
From cppreference.com
 
 
 < cpp | io | basic stringbuf 
 
 
 C++ 
 Feature test macros (C++20)
 Concepts library (C++20)
 Metaprogramming library (C++11)
 Ranges library (C++20)
 Filesystem library (C++17)
 Concurrency support library (C++11)
 Execution control library (C++26)
Input/output library 
 
 
 
 
 
 
 
 
 
 
 
 
 Print functions (C++23)
 Buffers
(C++23)
(C++98/26*)
(C++20)
 Streams
 Abstractions
 File I/O
 String I/O
 Array I/O
(C++23)
(C++23)
(C++23)
(C++98/26*)
(C++98/26*)
(C++98/26*)
 Synchronized Output
(C++20)
 Types
 Error category interface
(C++11)
(C++11)
std::basic_stringbuf 
 
 
 
 
 
 Public member functions
basic_stringbuf::operator=
(C++11)
(C++11)
(C++20)
(C++20)
 Protected member functions
 Non-member functions
(C++11)
 Exposition-only member functions
std::basic_stringbuf & operator=( std::basic_stringbuf && rhs );
 (1) 
 (since C++11) 
std::basic_stringbuf & operator=( const std::basic_stringbuf & rhs ) = delete;
 (2) 
 
1) Move assignment operator: Moves the contents of rhs into *this. After the move, *this has the associated string, the open mode, the locale, and all other state formerly held by rhs. The six pointers of std::basic_streambuf  in *this are guaranteed to be different from the corresponding pointers in the moved-from rhs unless null.
Contents
[edit] Parameters
 rhs
 -
 another 
basic_stringbuf that will be moved from
[edit] Return value
*this
[edit] Example
Run this code
#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"; }
Output:
Before move, one = "one" two = "two" After move, one = "two" two = ""