std::basic_stringbuf<CharT,Traits,Allocator>::operator= (3) - Linux Manuals
std::basic_stringbuf<CharT,Traits,Allocator>::operator=: std::basic_stringbuf<CharT,Traits,Allocator>::operator=
Command to display std::basic_stringbuf<CharT,Traits,Allocator>::operator=
manual in Linux: $ man 3 std::basic_stringbuf<CharT,Traits,Allocator>::operator=
NAME
std::basic_stringbuf<CharT,Traits,Allocator>::operator= - std::basic_stringbuf<CharT,Traits,Allocator>::operator=
Synopsis
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.
2) The copy assignment operator is deleted; basic_stringbuf is not CopyAssignable.
Parameters
rhs - another basic_stringbuf that will be moved from
Return value
*this
Example
// Run this code
#include <sstream>
#include <string>
#include <iostream>
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 = ""
See also
constructs a basic_stringbuf object
constructor (public member function)
Pages related to std::basic_stringbuf<CharT,Traits,Allocator>::operator=
- std::basic_stringbuf<CharT,Traits,Allocator>::overflow (3) - std::basic_stringbuf<CharT,Traits,Allocator>::overflow
- std::basic_stringbuf<CharT,Traits,Allocator>::basic_stringbuf (3) - std::basic_stringbuf<CharT,Traits,Allocator>::basic_stringbuf
- std::basic_stringbuf<CharT,Traits,Allocator>::pbackfail (3) - std::basic_stringbuf<CharT,Traits,Allocator>::pbackfail
- std::basic_stringbuf<CharT,Traits,Allocator>::seekoff (3) - std::basic_stringbuf<CharT,Traits,Allocator>::seekoff
- std::basic_stringbuf<CharT,Traits,Allocator>::seekpos (3) - std::basic_stringbuf<CharT,Traits,Allocator>::seekpos
- std::basic_stringbuf<CharT,Traits,Allocator>::setbuf (3) - std::basic_stringbuf<CharT,Traits,Allocator>::setbuf
- std::basic_stringbuf<CharT,Traits,Allocator>::str (3) - std::basic_stringbuf<CharT,Traits,Allocator>::str
- std::basic_stringbuf<CharT,Traits,Allocator>::swap (3) - std::basic_stringbuf<CharT,Traits,Allocator>::swap
- std::basic_stringbuf<CharT,Traits,Allocator>::underflow (3) - std::basic_stringbuf<CharT,Traits,Allocator>::underflow
- std::basic_stringbuf (3) - std::basic_stringbuf
- std::basic_string (3) - std::basic_string
- std::basic_string<CharT,Traits,Allocator>::append (3) - std::basic_string<CharT,Traits,Allocator>::append
- std::basic_string<CharT,Traits,Allocator>::assign (3) - std::basic_string<CharT,Traits,Allocator>::assign
- std::basic_string<CharT,Traits,Allocator>::at (3) - std::basic_string<CharT,Traits,Allocator>::at
- std::basic_string<CharT,Traits,Allocator>::back (3) - std::basic_string<CharT,Traits,Allocator>::back
- std::basic_string<CharT,Traits,Allocator>::basic_string (3) - std::basic_string<CharT,Traits,Allocator>::basic_string
- std::basic_string<CharT,Traits,Allocator>::begin, (3) - std::basic_string<CharT,Traits,Allocator>::begin,
- std::basic_string<CharT,Traits,Allocator>::begin,std::basic_string<CharT,Traits,Allocator>::cbegin (3) - std::basic_string<CharT,Traits,Allocator>::begin,std::basic_string<CharT,Traits,Allocator>::cbegin
- std::basic_string<CharT,Traits,Allocator>::c_str (3) - std::basic_string<CharT,Traits,Allocator>::c_str
- std::basic_string<CharT,Traits,Allocator>::capacity (3) - std::basic_string<CharT,Traits,Allocator>::capacity
- std::basic_string<CharT,Traits,Allocator>::clear (3) - std::basic_string<CharT,Traits,Allocator>::clear