名前空間
変種
操作

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

From cppreference.com
< cpp‎ | io‎ | basic stringbuf
 
 
 
 
(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 の対応するポインタとは異なります(nullでない場合)。
2) コピー代入演算子は削除されています。basic_stringbufCopyAssignable ではありません。

目次

[編集] パラメータ

rhs - 移動元となる別のbasic_stringbuf

[編集] 戻り値

*this

[編集]

#include <iostream>
#include <sstream>
#include <string>
 
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 オブジェクトを構築する
(public メンバ関数) [編集]
English 日本語 中文(简体) 中文(繁體)