std::basic_stringbuf<CharT,Traits,Allocator>::operator=
提供: cppreference.com
<tbody>
</tbody>
std::basic_stringbuf& operator=( std::basic_stringbuf&& rhs ); |
(1) | (C++11以上) |
std::basic_stringbuf& operator=( const std::basic_stringbuf& rhs ) = delete; |
(2) | |
1) ムーブ代入演算子。
rhs の内容を *this にムーブします。 ムーブの後、 *this は rhs がそれまで保持していた紐付けられた文字列、オープンモード、ロケール、およびその他のすべての状態を持ちます。 *this 内の std::basic_streambuf の6つのポインタはヌルでなければムーブされた rhs 内の対応するポインタと異なることが保証されます。引数
| rhs | - | ムーブする別の basic_stringbuf
|
戻り値
*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 = ""
関連項目
| basic_stringbuf オブジェクトを構築します (パブリックメンバ関数) |