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

履歴 編集

function
<spanstream>

std::basic_spanbuf::operator=(C++23)

basic_spanbuf& operator=(basic_spanbuf&& rhs);
basic_spanbuf& operator=(const basic_spanbuf&) = delete;

概要

ムーブ代入を行う。

効果

basic_spanbuf tmp{std::move(rhs)}; として tmp を作成後、this->swap(tmp); を実行するのと同等。

戻り値

*this

#include <iostream>
#include <span>
#include <spanstream>

int main()
{
  char buf1[32] = "first";
  char buf2[32] = "";
  std::spanbuf sb1{std::span<char>(buf1)};
  std::spanbuf sb2{std::span<char>(buf2)};

  // ムーブ代入
  sb2 = std::move(sb1);

  std::cout << sb2.span().data() << std::endl;
}

出力

first

バージョン

言語

  • C++23

処理系