名前空間
変種
操作

std::basic_stringbuf<CharT,Traits,Allocator>::operator=

提供: cppreference.com
< cpp‎ | io‎ | basic stringbuf
 
 
入出力ライブラリ
入出力マニピュレータ
Cスタイルの入出力
バッファ
(C++98で非推奨)
ストリーム
抽象
ファイル入出力
文字列入出力
配列入出力
(C++98で非推奨)
(C++98で非推奨)
(C++98で非推奨)
同期化出力
エラーカテゴリインタフェース
(C++11)
 
 
(1) (C++11以上)
std::basic_stringbuf& operator=( const std::basic_stringbuf& rhs ) = delete;
(2)
1) ムーブ代入演算子。 rhs の内容を *this にムーブします。 ムーブの後、 *thisrhs がそれまで保持していた紐付けられた文字列、オープンモード、ロケール、およびその他のすべての状態を持ちます。 *this 内の std::basic_streambuf の6つのポインタはヌルでなければムーブされた rhs 内の対応するポインタと異なることが保証されます。
2) コピー代入演算子は削除されています。 basic_stringbufCopyAssignable ではありません。

目次

[編集] 引数

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 = ""

[編集] 関連項目

basic_stringbuf オブジェクトを構築します
(パブリックメンバ関数) [edit]