TITLE: lack of streams with assign (Newsgroups: comp.lang.c++.moderated, 9 Jun 98) GASPERINA: "Marco Dalla Gasperina" >It used to be (I think) that the standard io streams cout, >cin, cerr, and clog were of type iostream_withassign so >that I could assign a new streambuf to them. This enabled >me to redirect stdout after I got to main. >Is something similar available with the newer iostreams? CLAMAGE: clamage@Eng.Sun.COM (Steve Clamage) The "withassign" types were never part of the iostream specification, but were an implementation detail needed to initialize the standard streams. The effects of assigning one stream to another were never defined formally, and different implementations would produce different results if you attempted it. (The implementation would do whatever it needed to get the standard streams initialized, which might not be what you wanted for general stream assignment.) The C++ Committee addressed the problem of stream assignment, and concluded that there is not just one set of semantics associated with stream assignment. Sometimes you want to copy the streambuf, sometimes the formatting information, and sometimes both. In the end, the stream classes use the rdbuf function to copy a streambuf, and the copyfmt function to copy the formatting flags (and associated data). Stream assignment is explictly not allowed. The assignment operator is private and not implemented.