最終更新日時(UTC):
が更新

履歴 編集

function
<sstream>

std::basic_stringbuf::operator=(C++11)

basic_stringbuf& operator=(basic_stringbuf&& rhs);           // (1) C++11
basic_stringbuf& operator=(const basic_stringbuf&) = delete; // (2) C++11

概要

ムーブ代入を行う。

効果

  • (1) : basic_streambuf<CharT, Traits>::operator=(std::move(rhs))を呼び出した後、mode = rhs.modebuf = std::move(rhs.buf)を実行する。ここでmodeは内部のオープンモード、bufは内部の文字列バッファである。

戻り値

*this

#include <iostream>
#include <sstream>
#include <string>

int main()
{
  std::stringbuf buf1("first");
  std::stringbuf buf2;

  // ムーブ代入
  buf2 = std::move(buf1);

  std::cout << buf2.str() << std::endl;
}

出力

first

バージョン

言語

  • C++11

処理系

  • Clang: 3.0 , 3.1 , 3.2 , 3.3 , 3.4 , 3.5.0 , 3.6.0 , 3.7.0 , 3.8.0
  • GCC: 5.1.0 , 5.2.0 , 6.0.0
  • ICC: ??
  • Visual C++: ??