std::basic_osyncstream<CharT,Traits,Allocator>:: operator=
|
basic_osyncstream
&
operator
=
(
std::
basic_osyncstream
&&
other
)
;
|
(C++20以降) | |
同期出力ストリームのムーブ代入:
ラップされた
std::basic_syncbuf
を
other
の対応するメンバからムーブ代入する(このムーブ代入後、
other.
get_wrapped
(
)
はヌルポインタを返し、
other
の破棄は出力を生成しない。保留中のバッファリングされた出力は出力される)。また基底クラス
std::basic_ostream
を
ムーブ代入
する(これにより
rdbuf
を除くすべてのストリーム状態変数が
*
this
と
other
の間で交換される)
目次 |
パラメータ
| other | - | 移動元の別の同期出力ストリーム |
戻り値
* this
例
#include <iomanip> #include <iostream> #include <sstream> #include <syncstream> #include <utility> int main() { std::osyncstream out(std::cout); out << "test\n"; std::ostringstream str_out; std::osyncstream{str_out} = std::move(out); // Note that out is emitted here std::cout << "str_out = " << std::quoted(str_out.view()) << '\n'; }
出力:
test str_out = ""
不具合報告
以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。
| DR | 適用対象 | 公開時の動作 | 正しい動作 |
|---|---|---|---|
| LWG 3867 | C++20 |
ムーブ代入演算子は
noexcept
であったが、
std::basic_syncbuf のムーブ代入演算子はそうではない |
noexcept を削除 |
関連項目
basic_osyncstream
オブジェクトを構築する
(public member function) |
|
basic_osyncstream
を破棄し、内部バッファを出力する
(public member function) |
|
基盤となる
basic_syncbuf
の
emit()
を呼び出し、内部データを最終的な宛先に転送する
(public member function) |