| I/O manipulators | ||||
| Print functions(C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++20) | ||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
| Synchronized Output | ||||
(C++20) | ||||
| Types | ||||
| Error category interface | ||||
(C++11) | ||||
(C++11) |
| Public member functions | ||||
basic_osyncstream::operator= (C++20) | ||||
(C++20) | ||||
(C++20) |
basic_osyncstream& operator=(std::basic_osyncstream&& other); | (since C++20) | |
Move-assigns a synchronized output stream:
Move-assigns the wrappedstd::basic_syncbuf from the corresponding member ofother (after this move-assignment,other.get_wrapped() returns a null pointer and destruction ofother produces no output; any pending buffered output will be emitted) andmove-assigns the basestd::basic_ostream (this swaps all stream state variables except forrdbuf between*this andother)
Contents |
| other | - | another synchronized output stream to move from |
*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 herestd::cout<<"str_out = "<<std::quoted(str_out.view())<<'\n';}
Output:
teststr_out = ""
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 3867 | C++20 | the move assignment operator wasnoexcept, but std::basic_syncbuf's move assignment operator is not | removednoexcept |
constructs abasic_osyncstream object(public member function)[edit] | |
destroys thebasic_osyncstream and emits its internal buffer(public member function)[edit] | |
callsemit() on the underlyingbasic_syncbuf to transmit its internal data to the final destination(public member function)[edit] |