std::basic_stringbuf::operator=
来自cppreference.com
< cpp | io | basic stringbuf
![]() |
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
std::basic_stringbuf& operator=( std::basic_stringbuf&& rhs ); |
(C++11 起) | |
std::basic_stringbuf& operator=( const std::basic_stringbuf& rhs ) = delete; |
||
1)
将赋值运算符:将内容
rhs
*this
。移动后,lhs
有关联的字符串,开模,语言环境,和所有其他国家持有的rhs
。的六个指针std::basic_streambuflhs
保证是从相应的指针在空值的移动,从rhs
除非不同.原文:
Move assignment operator: Moves the contents of
rhs
into *this
. After the move, lhs
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 lhs
are guaranteed to be different from the corresponding pointers in the moved-from rhs
unless null.2)
拷贝赋值运算符被删除;
basic_stringbuf
是不CopyAssignable
.原文:
The copy assignment operator is deleted;
basic_stringbuf
is not CopyAssignable
.目录 |
[编辑] 参数
rhs | - | 另一个
basic_stringbuf 将移动原文: another basic_stringbuf that will be moved from |
[编辑] 返回值
*this
[编辑] 示例
#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 << "Before move, one = \"" << one.str() << '"' << " two = \"" << two.str() << "\"\n"; }
输出:
Before move, one = "one" two = "two" Before move, one = "two" two = ""
[编辑] 另请参阅
构造一个的basic_stringbuf对象 (公共成员函数) |