GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::basic_stringbuf::operator=(3) C++ Standard Libary std::basic_stringbuf::operator=(3)

std::basic_stringbuf::operator= - std::basic_stringbuf::operator=


std::basic_stringbuf& operator=( std::basic_stringbuf&& rhs ); (1) (since C++11)
std::basic_stringbuf& operator=( const std::basic_stringbuf& rhs ) (2)
= delete;


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.


rhs - another basic_stringbuf that will be moved from


*this

// 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";
}


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


constructor constructs a basic_stringbuf object
(public member function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.