std::basic_stringbuf<CharT,Traits,Allocator>::operator= - cppreference.com
提供: cppreference.com
<tbody> </tbody>
|
|
(1) | (C++11以上) |
|
|
(2) | |
1) ムーブ代入演算子。 rhs の内容を *this にムーブします。 ムーブの後、 *this は rhs がそれまで保持していた紐付けられた文字列、オープンモード、ロケール、およびその他のすべての状態を持ちます。 *this 内の std::basic_streambuf の6つのポインタはヌルでなければムーブされた rhs 内の対応するポインタと異なることが保証されます。
2) コピー代入演算子は削除されています。 basic_stringbuf は CopyAssignable ではありません。
引数
| rhs | - | ムーブする別の basic_stringbuf
|
戻り値
*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 << "After move, one = \"" << one.str() << '"' << " two = \"" << two.str() << "\"\n"; }
出力:
Before move, one = "one" two = "two" After move, one = "two" two = ""