Should basic_*stream::is_open() be const?

Andreas Kohn andreas@syndrom23.de
Fri Aug 13 00:24:00 GMT 2004


Hi,

while porting some code written for Microsoft Visual C++, I found that
the is_open() method of the different streams in <fstream> is not const.
This required that I had to remove const from a lot of places in the
code in question.

The basic_filebuf::is_open() is marked as const, and all
*stream::is_open() methods only reference basic_filebuf::is_open() in
their is_open() implementation. 
I do not see a particular reason why the is_open() methods couldn't be
const as well. 

I do know that there is a C++ Standard, but I don't have it for
reference, so I am not perfectly sure if this is a "bug" in libstdc++,
the Microsoft STL implementation, or perhaps an omission from the
standard. 

I would be very grateful if you could enlighten me a little :)

Thank you very much!

Regards,
Andreas Kohn

PS: g++ 3.4's version of libstdc++.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040813/d77d80cf/attachment.sig>


More information about the Libstdc++ mailing list