std::basic_istream::operator=
来自cppreference.com
< cpp | io | basic istream
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
protected: basic_istream& operator=( const basic_istream& rhs ) = delete; |
(1) | |
protected: basic_istream& operator=( basic_istream&& rhs ); |
(2) | (C++11 起) |
拷贝赋值运算符的保护,而且将被删除。输入流不CopyAssignable的.
2) 原文:
The copy assignment operator is protected, and is deleted. Input streams are not CopyAssignable.
移动赋值运算符交流gcount的()值和基类的所有数据成员,除了
rdbuf()
,rhs
,如果通过调用swap(*rhs)。这一举动赋值运算符的保护:它只能被称为运营商的移动输入流类派生的举动所分配std::basic_ifstreamstd::basic_istringstream,哪知道如何正确地移动分配的相关streambuffers.原文:
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 | - | 将basic_istream对象从中分配给*this
原文: the basic_istream object from which to assign to *this |
[编辑] 示例
#include <sstream> #include <iostream> int main() { std::istringstream s1; s1 = std::istringstream("test"); // OK std::cin = std::istringstream("test"); // ERROR: 'operator=' is protected }