This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]