| 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) |
| Global objects | ||||
| Member functions | ||||
basic_ostream::operator= (C++11) | ||||
| Formatted output | ||||
| Unformatted output | ||||
| Positioning | ||||
| Miscellaneous | ||||
(C++11) | ||||
| Member classes | ||||
| Non-member functions | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
protected: basic_ostream& operator=(const basic_ostream& rhs)= delete; | (1) | |
protected: basic_ostream& operator=( basic_ostream&& rhs); | (2) | (since C++11) |
| rhs | - | thebasic_ostream object from which to assign to*this |
#include <iostream>#include <sstream>#include <utility> int main(){std::ostringstream s;// std::cout = s; // ERROR: copy assignment operator is deleted// std::cout = std::move(s); // ERROR: move assignment operator is protected s= std::move(std::ostringstream()<<42);// OK, moved through derivedstd::cout<< s.str()<<'\n';}
Output:
42
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2067 | C++11 | 1. the parameter type of overload(1) wasbasic_ostream&2. the parameter type of overload(2) wasconst basic_ostream&& | 1. addedconst 2. removedconst |