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

Paolo Carlini pcarlini@suse.de
Fri Aug 13 16:40:00 GMT 2004


Gabriel Dos Reis wrote:

>"Vladimir Merzliakov" <wanderer@rsu.ru> writes:
>
>| class Parser {
>|    std:ifstream m_in;
>|    public: bool isOK() const { return m_in.is_open(); }
>| };
>| 
>| ?
>
>You're telling me that you need a const member function because you
>need a constant member function.  A parser, is kind of stream.  My
>question was what do you with a const stream.
>
Vladimir point is exactly that you don't need a const stream (pointless) to
appreciate the usefulness of a const version of is_open().

>If your const parser is not OK what do you to it?
>  
>
Which const parser? I see just a Parser class, above, that doesn't compile
without my patch and does after, of course.

Paolo.



More information about the Libstdc++ mailing list