
Chad Walters wrote:
A couple thoughts:
1. One of the first confusions that I naively had when I first approached the library was that classes that had close() methods did not necessarily model Closable. I am not sure if this means that “Closable” is a bad name and should be changed, but it might be worth calling out this distinction more pointedly in the documentation.
I think I've finally made all classes with close() methods Closable, as of revision 43299. Let me know if you find any more. Here's how close() now behaves on various types that previously weren't Closable: type semantics ---- --------- ifstream, ofstream, s.close() fstream, filebuf, stream, stream_buffer istringstream, s.str("") ostringstream, stringstream, stringbuf filtering_stream, s.pop() filtering_streambuf
2. Perhaps for filtering streams, it would be best to make sure that closing the stream would close all the filters and flush the device.. Would that solve this issue? Or is that already the current behavior?
That's an interesting idea. It might work most of the time, but the semantics of flush() don't actually require a device to do anything, so the problem would probably still show up once in a while.
Chad
Best Regards, -- Jonathan Turkanis CodeRage http://www.coderage.com