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_istream::operator=(3) C++ Standard Libary std::basic_istream::operator=(3)

std::basic_istream::operator= - std::basic_istream::operator=


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


1) The copy assignment operator is protected, and is deleted. Input streams are not
CopyAssignable.


2) The move assignment operator exchanges the gcount() values and all data members
of the base class, except for rdbuf(), with rhs, as if by calling swap(*rhs). This
move assignment operator is protected: it is only called by the move assignment
operators of the derived movable input stream classes std::basic_ifstream and
std::basic_istringstream, which know how to correctly move-assign the associated
streambuffers.


rhs - the basic_istream object from which to assign to *this

// Run this code


#include <sstream>
#include <iostream>


int main()
{
std::istringstream s1;
s1 = std::istringstream("test"); // OK


std::cin = std::istringstream("test"); // ERROR: 'operator=' is protected
}

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.