Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!odi!benson From: benson@odi.com (Benson I. Margulies) Newsgroups: comp.lang.c++ Subject: Re: ostream_with_assign versus specialization of cout? Message-ID: <1989Dec22.124506.19964@odi.com> Date: 22 Dec 89 12:45:06 GMT References: <1989Dec19.175438.12843@odi.com> <9806@ardent.UUCP> Reply-To: benson@odi.com (Benson I. Margulies) Organization: Object Design Inc., Burlington, MA Lines: 28 In article <9806@ardent.UUCP> jss@jra.ardent.com () writes: >In article <1989Dec19.175438.12843@odi.com> benson@odi.com () writes: >>I've got a derived class of ostream that internally sets the unitbuf >>flag. I tried >> >> cout = one_of_my_streams; >> >>The operator= goes and reinitializes the stream, clearing the >>crucial flag (unitbuf). If operator= is going to do this, >>it seems that cout should have been a pointer. As it is, >>one can't make cout be another type, it seems. > >I tend to agree. The predefined classes ought to have been >pointers rather than streams, however I didn't feel that >iostreams could make that radical a departure from streams. Unfortunately, your coding style is not in the documentation, so there is lots of code that is prone to just using cout. As per my previous post today, making streambuf::init virtual would make is possible to assign any stream that hides all its specific functionality in the streambuf. At very least, there should be a kind of ostream which just forwards the data off to some other stream. -- Benson I. Margulies